From d0f1d6c8fa08a55a61186b836024a1b8537badbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20R=2E=20Sede=C3=B1o?= Date: Thu, 24 May 2018 22:08:04 -0400 Subject: 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 --- lib/content_encoding.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') 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) { -- cgit v1.2.3