summaryrefslogtreecommitdiff
path: root/content/fetchers/curl.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-11-05 22:10:46 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-11-05 22:10:46 +0000
commitda2b1ce44dcb53fc5a121cbe7f14fcc65c671cb5 (patch)
tree3e1f7619b901678d99dd11271abc0fab22d44406 /content/fetchers/curl.c
parent3776e49f02bab41706fde9561443478b05cab729 (diff)
downloadnetsurf-da2b1ce44dcb53fc5a121cbe7f14fcc65c671cb5.tar.gz
netsurf-da2b1ce44dcb53fc5a121cbe7f14fcc65c671cb5.tar.bz2
Hack around curl complaining about junk gzip streams
svn path=/trunk/netsurf/; revision=13129
Diffstat (limited to 'content/fetchers/curl.c')
-rw-r--r--content/fetchers/curl.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 962def666..87be66a09 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -806,8 +806,16 @@ void fetch_curl_done(CURL *curl_handle, CURLcode result)
abort_fetch = f->abort;
LOG(("done %s", nsurl_access(f->url)));
- if (abort_fetch == false && result == CURLE_OK) {
- /* fetch completed normally */
+ if (abort_fetch == false && (result == CURLE_OK ||
+ (result == CURLE_WRITE_ERROR && f->stopped == false))) {
+ /* fetch completed normally or the server fed us a junk gzip
+ * stream (usually in the form of garbage at the end of the
+ * stream). Curl will have fed us all but the last chunk of
+ * decoded data, which is sad as, if we'd received the last
+ * chunk, too, we'd be able to render the whole object.
+ * As is, we'll just have to accept that the end of the
+ * object will be truncated in this case and leave it to
+ * the content handlers to cope. */
if (f->stopped ||
(!f->had_headers &&
fetch_curl_process_headers(f)))