RESOLVED FIXED 28466
[GTK] When downloading a file, two GET requests are sent to the HTTP server
https://bugs.webkit.org/show_bug.cgi?id=28466
Summary [GTK] When downloading a file, two GET requests are sent to the HTTP server
Enrico Tröger
Reported 2009-08-19 12:20:53 PDT
When trying to download a file with WebKitGTK, it sends two HTTP GET requests to the server for some reason. In most cases this doesn't matter, but in some cases it does indeed. Example use case: One-time downloads as sometimes seen on download-as-a-service offers. The user requests a file to download, then the user gets an id or token for the download and with this token, the file can be downloaded once. This works in Firefox 3.0 and 3.5, Arora (with the Qt Webkit port), Opera and Internet Explorer but not with WebKitGTK. As far as I observed it, WebKitGTK sends the first request once the download link is clicked and this request is immediately cancelled. After the user chose an action to handle the download (i.e. chose a download location), the second GET request is sent. Services like the above mentioned, deliver the file already on the first GET request, the second request is then invalid as the download URL is only valid one time. To ease testing, I set up a sample service on http://78.31.68.117:18695/dstest.py?action=request&data=test.deb To reproduce: - open the above URL in a WebKitGTK browser - then open the displayed URL in the browser - a download is started - check the downloaded file: it doesn't contain a Debian package but a HTTP error page because the generated URL was called twice by WebKitGTK Tested with WebKitGTK 1.1.12, Midori (GIT) and Epiphany 2.27.90.
Attachments
reuse connection for download (8.83 KB, patch)
2009-08-31 14:26 PDT, Gustavo Noronha (kov)
ap: review+
gustavo: commit-queue-
Gustavo Noronha (kov)
Comment 1 2009-08-21 13:33:39 PDT
I am almost sure this is caused by this: void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response) { // FIXME: We could reuse the same handle here, but when I tried // implementing that the main load would fail and stop, so I have // simplified this case for now. handle->cancel(); We should really use the handle which already exists for the download, but I could not get it to work when I tried, like I say in the comment.
Gustavo Noronha (kov)
Comment 2 2009-08-31 14:26:38 PDT
Created attachment 38834 [details] reuse connection for download This patch should fix this problem.
Enrico Tröger
Comment 3 2009-08-31 14:52:52 PDT
Yes, the patch seems to work. Though I tested it only with my special use case as posted in the original description. Good job!
Alexey Proskuryakov
Comment 4 2009-08-31 16:56:14 PDT
Comment on attachment 38834 [details] reuse connection for download + // us back after we release it, unless it has been replaced by someone + // else. I'd just put the else on the previous line - it's not too long by WebKit standards. r=me
Gustavo Noronha (kov)
Comment 5 2009-08-31 20:30:48 PDT
Landed as r47916.
Note You need to log in before you can comment on or make changes to this bug.