GNOME Bugzilla – Bug 724970
GsfInputGio is unable to read files from http
Last modified: 2014-03-07 23:03:02 UTC
This occurs because the file size is not correct in GFileInfo. Looks like it's always 0, and then Gsf refuse to read anything.
Do we have an easy test for this?
The abiword bug in the "See Also" field.
We have two different http readers: gsf-input-http.c [based on nanohttp from libxml2] gsf-input-gio.c [glib] I see the same bug for both: we get a length that isn't right. In my case (reading http://www.gnumeric.org/download.html) the size I see is the one in the http header. That's "Content-Length: 1057" which is the content's size subject to "Content-Encoding: gzip". I.e., it is useless and nanohttp claims we cannot rely on it anyway.
Filed bug 725782 with glib/gio for that.
Hmm... gio has 245 open bugs. I probably wasted my time reporting that.
Workaround committed. Please test.
Abiword freezes. Seems gio tries to mount the http directory. This is just stupid, imho.
+ Trace 233274
Ok, found a working solution: we need to check in go_file_open() if the uri starts with "http://" or "https://" and return a GsfInputHTTP if yes and a GsfInputGIO if not.
But this still leaves the size issue. I can open images from http in abiword, but not html files (premature end of data).
Created attachment 271093 [details] [review] Proposed patch This patch (along with a go-file.c patch) makes abiword able to read http://www.gnumeric.org/download.html
Patch is fine, but please add a reference to this bug when you commit. Note, that even if nanohttp returned the right size we would still need this kind of code because nanohttp documents that the size is sometimes not available.
Created attachment 271102 [details] [review] Corresponding goffice patch
You need to test the protocal with g_ascii_strncasecmp since the protocol is not case sensitive. Also, that needs a comment are someone will optimize it away one day. Other than that, go ahead and commit.
Done, may be we can close even if GIO itself is not fixed.
Yes, we no longer get hit by the gio/gvfs issue. This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.
One should note that gio has the potential to be better than libxml for this purpose. If a login is required, for example, gio might work where libxml will not. As long as it doesn't work that is purely hypothetical, of course.