From da2b1ce44dcb53fc5a121cbe7f14fcc65c671cb5 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 5 Nov 2011 22:10:46 +0000 Subject: Hack around curl complaining about junk gzip streams svn path=/trunk/netsurf/; revision=13129 --- content/fetchers/curl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'content/fetchers') 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))) -- cgit v1.2.3