summaryrefslogtreecommitdiff
path: root/lib/content_encoding.c
diff options
context:
space:
mode:
authorAlejandro R. SedeƱo <asedeno@mit.edu>2018-05-24 22:08:04 -0400
committerDaniel Stenberg <daniel@haxx.se>2018-05-25 10:04:08 +0200
commitd0f1d6c8fa08a55a61186b836024a1b8537badbc (patch)
tree3541ff199b12e5b32da790b484f752fbf1873941 /lib/content_encoding.c
parent3e0dee065f3a286d5ea85e767d2369a4061c8a55 (diff)
downloadcurl-d0f1d6c8fa08a55a61186b836024a1b8537badbc.tar.gz
content_encoding: handle zlib versions too old for Z_BLOCK
Fallback on Z_SYNC_FLUSH when Z_BLOCK is not available. Fixes #2606 Closes #2608
Diffstat (limited to 'lib/content_encoding.c')
-rw-r--r--lib/content_encoding.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index 7c979efcc..b1c5b5012 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -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) {