GNOME Bugzilla – Bug 332816
neon-based http module can't transfer from server which don't allow HEAD
Last modified: 2018-08-17 13:49:29 UTC
The old http module contained code to handle servers which work with GET but report errors for HEAD (in do_get_file_info, line 2695 of current cvs). The neon-based http module doesn't contain this, which makes gnome_vfs_xfer_uri not work for URIs on those kinds of servers.
How to reproduce. 1) Install the attached PHP script on your local web server. 2) Invoke 'gnomevfs-info http://localhost/332816.php' Expected result: Name : 332816.php Type : Regular MIME type : text/html Default app : epiphany.desktop Access time : Sun Mar 5 00:39:26 2006 Current result: Error: Unsupported operation
Created attachment 60670 [details] 332816.php - PHP script which refuses to handle HEAD requests
Created attachment 60671 [details] [review] gnome-bug-332816.patch Solves the problem for the virtual test case. Hope it also handles your problematic server, Doc.
Created attachment 60673 [details] [review] gnome-bug-332816-r1.patch Variant of the version patch, trying not to read the response body, when falling back to GET request.
Created attachment 60676 [details] [review] gnome-bug-332816-r2.patch Third incarnation: Taking into account, that some broken servers send real content in response to HEAD requests. So I try avoid reading of the reponse body for GET *and* HEAD requests now. Nice side effect: The icecast workarround should not be needed anymore, as fetch_headers should automatically take care about it.
I seem to be lacking the necessary library-path-fu today to get this to work. An example URI that doesn't work is http://images.amazon.com/images/P/Burnout%203%20Soundtrack.01._SCTHUMBZZZ_.jpg, which is one of Amazon's cover art images.
Yay! Another version of BROKEN WEBSERVER. YAY! <some swearing>#$)(U*$)(#U)F(DUE)F(U#)($U$)(U</some swearing> See: +-[1 HEAD]-----------------------------------------------------------+ HEAD /images/P/Burnout%203%20Soundtrack.01._SCTHUMBZZZ_.jpg HTTP/1.1 Host: images.amazon.com User-Agent: gnome-vfs/2.13.92 neon/0.25.4 [...] HTTP/1.1 404 Not Found Content-Type: text/html; charset=iso-8859-1 [...] +----------------------------------------------+ And now: +-[1 GET]------------------------------------------------------------+ GET /images/P/Burnout%203%20Soundtrack.01._SCTHUMBZZZ_.jpg HTTP/1.1 Host: images.amazon.com User-Agent: gnome-vfs/2.13.92 neon/0.25.4 HTTP/1.1 200 OK Server: Apache Content-Type: image/gif Content-Length: 807 X-Junk: xxxxx +----------------------------------------------+ GET /images/P/Burnout%203%20Soundtrack.01._SCTHUMBZZZ_.jpg HTTP/1.1 HEAD /images/P/Burnout%203%20Soundtrack.01._SCTHUMBZZZ_.jpg HTTP/1.1 This is not a gnome-vfs bug. It is NOT!. But anyway, maybe we *should* fallback to get in any case that HEAD didn't work. Gives us another roundtrip but *shrug*. Or just get rid of doing HEAD at all and always killing the connection. Since nobody else gives a damn about RFCs maybe we shoudn't do either. Opinions and comments are welcome! ;)
Reassigning to me, so I have that sticky in my TODO
*** Bug 343709 has been marked as a duplicate of this bug. ***
Would it at least be possible to return something other than 'generic error' to the program? libwww-perl's "Server closed connection without sending any data back" is short and descriptive. I'm sick of seeing "Unknown playback error" messages in Rhythmbox. :)
I've played around a bit with the latest version of the patch here and it seems to be working well for the cases that it means to fix, i.e. when the server doesn't support HEAD at all and when it actually sends the content as well for HEAD requests. The amazon example is just so broken, I wonder if it wouldn't be better to bug them to fix the server. However, I had to change + if (GNOME_VFS_ERROR_NOT_SUPPORTED == result) { to if (res == NE_ERROR) since I always get that when HEAD isn't working (which translates to generic error). Maybe we need to check res == NE_ERROR || result == GNOME_VFS_ERROR_NOT_SUPPORTED)? Should we get this committed? It does fix a lot of broken audio streaming servers, which seem to be plenty in numbers. And for working servers that return proper responses, we won't get the extra roundtrip for normal errors like not found etc.
I ran into an issue with the patch, if the connection goes down while in the workaround code, there is a crash: + if (NE_OK == res) + res = ne_end_request(req); If len has returned -1 just above, there is no socket to end the request with, resulting in a crash. Also I think it would be better to separate the retry loop for begin and end. I will attach the patch I am using myself (slighty edited with names and comments, sorry about that, but it makes it easier to understand for me every time I have to go back and look at it again...).
Created attachment 99011 [details] [review] Fix crash with the previous patch
Mass re-assignin old gnome-vfs http bugs to gnome-vfs-maint@gnome.bugs so they disappear from my "My bugs" list. Sorry for the spam.
gnome-vfs got deprecated in 2008. gnome-vfs is not under active development anymore and had its last code changes in 2011. Its codebase has been archived: https://gitlab.gnome.org/Archive/gnome-vfs/commits/master gio (in glib) and gvfs are its successors. See https://developer.gnome.org/gio/stable/ch33.html and https://people.gnome.org/~gicmo/gio-migration-guide/ for porting info. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Feel free to open a task in GNOME Gitlab if the issue described in this task still applies to a recent + supported version of glib/gio/gvfs. Thanks!