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
This commit is contained in:
Alejandro R. Sedeño 2018-05-24 22:08:04 -04:00 committed by Daniel Stenberg
parent 3e0dee065f
commit d0f1d6c8fa
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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) {