From: Yann Ylavic Date: Thu, 27 Feb 2014 18:01:38 +0000 (+0000) Subject: Commit 4 on 6 to fix reentrance (incomplete Zlib header or validation bytes) in mod_d... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aff28890f66f3d8e2b64b8ee60490ce6f75d058;p=thirdparty%2Fapache%2Fhttpd.git Commit 4 on 6 to fix reentrance (incomplete Zlib header or validation bytes) in mod_deflate's output and input filters. PR 46146 (patches from duplicated PR 55666) Handle non blocking reads which would block in the inflate input filter (not an error). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572669 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index d13bb164d54..eed159b2301 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -1117,8 +1117,15 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, if (APR_BRIGADE_EMPTY(ctx->proc_bb)) { rv = ap_get_brigade(f->next, ctx->bb, mode, block, readbytes); + /* Don't terminate on EAGAIN (or success with an empty brigade in + * non-blocking mode), just return focus. + */ + if (block == APR_NONBLOCK_READ + && (APR_STATUS_IS_EAGAIN(rv) + || (rv == APR_SUCCESS && APR_BRIGADE_EMPTY(ctx->bb)))) { + return rv; + } if (rv != APR_SUCCESS) { - /* What about APR_EAGAIN errors? */ inflateEnd(&ctx->stream); return rv; }