Is there a way to detect if a HTTP resource has been changed without downloading it?
The case is: I have a file on the filesystem, which needs to be synced with a file on a HTTP server; if the file on the ESP is updated, it should be uploaded to the HTTP server; and if the file on the server is changed, the ESP should download and update its local copy.
What is the best way to check if the resource has been changed on the server, if there is such a way, without downloading it? I'll run a periodic task which will check for updates, and if I need to download the file each time that will add to a lot of overhead and needless SD card wearing.
HTTP client detect if resourse has been updated
-
- Posts: 9746
- Joined: Thu Nov 26, 2015 4:08 am
Re: HTTP client detect if resourse has been updated
Purely looking at the HTTP protocol itself, you could either use a HEAD (instead of a GET) request to get only the headers of the page and then look at the 'last-modified' header, or you could use an If-Modified-Since field to tell the webserver to only return a result if the file has changed after a certain date.
Who is online
Users browsing this forum: arunbm123, Baidu [Spider] and 90 guests