]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Commit 4 on 6 to fix reentrance (incomplete Zlib header or validation bytes) in mod_d...
authorYann Ylavic <ylavic@apache.org>
Thu, 27 Feb 2014 18:01:38 +0000 (18:01 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 27 Feb 2014 18:01:38 +0000 (18:01 +0000)
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

modules/filters/mod_deflate.c

index d13bb164d54bb4d06b41a8a025320b6c2b38261e..eed159b2301b37e5e1e2e13aa61f36650d0f21a8 100644 (file)
@@ -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;
         }