Support Conditional GET
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-download-manager (Ubuntu) |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
It is possible to pass If-Modified-Since and ETag headers to an HTTP GET request; if the server believes that the file has not changed from the last download (where you got the Last-Modified and ETag data) then it will return a 304 Not Modified response.
Ideally, therefore, it would be possible to do this with the Download Manager. That is, from QML, I do
downloadmanager
and when that request completes I get the path of the downloaded file, but I also get the ETag and Last-Modified that the server supplied. I can then cache that ETag and Last-Modified. Later, I want to download that file again, *only if it's changed on the server*. So I call
downloadmanager
The DLM sees that I supplied an etag and lastmodified, so it adds ETag and If-Modified-Since headers to the GET request. It also works out where it would download that file to, and looks to see if a file already exists at that path. If a file exists at that path, and the server returns 304 Not Modified to the HTTP request, then the DLM says "aha, the file hasn't changed, and there is already a download for this, so I shall assume that the file on disk is the file that I would have downloaded", and it returns *the existing file path* as the path of the download.
If my app edits the file on disk, it is my app's responsibility to invalidate its cached ETag and LastModified values. If my app does not do that, then the DLM will not download a newer version of the file, but that's my own fault.
Note that if I've deleted the file on disk, the DLM should ignore any passed etag/lastmodified data, because there's no disk file.
This requires the DLM to make the ETag and Last Modified values from the response headers available to the calling app when a download completes.
(For extra thought: perhaps if I pass ETag and LastModified I should also pass a file path of the file on disk? The DLM doesn't *read* that file, but it checks that it exists. That way we don't get problems with "file (1).txt" and so on.)
description: | updated |
Changed in ubuntu-download-manager: | |
status: | New → Triaged |
importance: | Undecided → Wishlist |
assignee: | nobody → Manuel de la Peña (mandel) |
Changed in ubuntu-download-manager (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Wishlist |
no longer affects: | ubuntu-download-manager |
See http:// fishbowl. pastiche. org/2002/ 10/21/http_ conditional_ get_for_ rss_hackers/ for a more detailed walkthrough.