Skip to content

Conversation

svendr
Copy link

@svendr svendr commented May 19, 2022

This PR tries to avoid constant re-downloading of the files wss-unified-agent.jar and wss-unified-agent.config, if the local last-modified-date is equal or newer than the last-modified-date of the remote file. This concept is known as Conditional GET Request and is commonly used to save download times and reduce unnecessary network usage. curl's -z option takes care of the heavy work here, see man curl.

…ontent hasn't changed since the last download
@r0bb3n
Copy link

r0bb3n commented Oct 5, 2022

I would recommend to make use of ETag instead, see Check by modification of content.

Using ETags, curl can check for remote updates without having to rely on times or file dates. It also then makes the check able to detect sub-second changes, which the timestamp based checks cannot.

curl --etag-compare etag.txt --etag-save etag.txt \
  https://example.com/file -o output

UPDATE
FYI: There seems to be a bug in curl prior to v7.70.0, that prevents using etags in this constellation, see this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants