]> granicus.if.org Git - curl/commitdiff
content_encoding: handle zlib versions too old for Z_BLOCK
authorAlejandro R. Sedeño <asedeno@mit.edu>
Fri, 25 May 2018 02:08:04 +0000 (22:08 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 25 May 2018 08:04:08 +0000 (10:04 +0200)
Fallback on Z_SYNC_FLUSH when Z_BLOCK is not available.

Fixes #2606
Closes #2608

lib/content_encoding.c

index 7c979efcc3608b54e32be56ba5e98858d0db1f3a..b1c5b50120ebac60a4963c516bb5c408787f7911 100644 (file)
@@ -190,7 +190,13 @@ static CURLcode inflate_stream(struct connectdata *conn,
     z->next_out = (Bytef *) decomp;
     z->avail_out = DSIZ;
 
+#ifdef Z_BLOCK
+    /* Z_BLOCK is only available in zlib ver. >= 1.2.0.5 */
     status = inflate(z, Z_BLOCK);
+#else
+    /* fallback for zlib ver. < 1.2.0.5 */
+    status = inflate(z, Z_SYNC_FLUSH);
+#endif
 
     /* Flush output data if some. */
     if(z->avail_out != DSIZ) {