curl / Mailing Lists / curl-library / Single Mail

curl-library

GET requests with gzip encoding fail with CURLE_WRITE_ERROR

From: Dmitri Trembovetski via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 19 Apr 2019 14:01:44 -0700

  Hi,

  As with my earlier email to this list, the configuration is
self-compiled libcurl with HTTP/2 support (openssl, nghttp2) for my
project.
  curl 7.64.1
  nghttp2 v1.37.0
  openssl 1.1.0
  I've compiled and run the same app on MacOSX, Android (x64), and Linux with
the same results.

  It uses platform zlib for gzip encoding on MacOSX (compatibility
version 1.0.0, current version 1.2.11), on linux zlib was 1.2.8
(libz.so.1.2.8), and on Android who knows, so it doesn't look like
zlib version is the issue.

  I'm using multi interface.

  The problem is that if I enable gzip encoding
(curl_easy_setopt(handle, CURLOPT_ACCEPT_ENCODING, "gzip")) my GET
requests fail with CURLE_WRITE_ERROR.
  Note that the error is not caused by my WRITE callback's return
value, it originates from process_trailer() function in
lib/content_encoding.c:
static CURLcode process_trailer(struct connectdata *conn, zlib_params *zp)
{
...
  z->next_in += len;
  if(z->avail_in) {
    result = CURLE_WRITE_ERROR; <<< here
  }

  This is before my WRITE callback is invoked for this batch of data.

  This happens with HTTP1.1 and HTTP/2 (so unrelated to my earlier
issue that I asked about on this list).

  It doesn't fail on every GET request, looks like only if the request
has a few tens of KB of data to read.

 The interesting thing is that it worked with earlier curl version
(7.56.1, I haven't bisected further) in the same exact environments,
with the same server, both with HTTP 1.1 and /2 (HTTP/2 didn't work
for me on POSTs on 7.56.1 but GETs were fine).

  Attaching relevant part of the log (taken on MacOSX) with debug
tracing enabled and a diff that I applied for my very sophisticated
debugging. In the log 0x7f9c79813c00 is the handle which failed.

  Has something changed between those curl versions? Perhaps some
validation was added or something?

  Thanks,
  Dmitri

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-04-19