** Also affects: ubuntu-download-manager (Ubuntu)
Importance: Undecided
Status: New
** Changed in: ubuntu-download-manager (Ubuntu)
Status: New => Triaged
** Changed in: ubuntu-download-manager (Ubuntu)
Importance: Undecided => Wishlist
** No longer affects: ubuntu-download-manager
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-download-manager in
Ubuntu.
https://bugs.launchpad.net/bugs/1288905
Title:
Support Conditional GET
Status in ubuntu-download-manager package in Ubuntu:
Triaged
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.download("http://example.org/somefile.txt")
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.download("http://example.org/somefile.txt", {ETag:
myCachedETag, LastModified: myCachedLastModified});
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.)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-download-manager/+bug/1288905/+subscriptions
--
Mailing list: https://launchpad.net/~touch-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp