From 59efbca396685c51ff90f31e0a88c510eebb3e9a Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Tue, 15 Apr 2014 14:29:30 +0000 Subject: [PATCH] mod_deflate: Delay INFLATE input filter's self removal until all the buffered buckets are out (including EOS). PR 46146. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1587594 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_deflate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 96205f1970..2d9a5f1474 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -1194,7 +1194,6 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, /* Move everything to the returning brigade. */ APR_BUCKET_REMOVE(bkt); APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, bkt); - ap_remove_input_filter(f); break; } @@ -1368,8 +1367,8 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, * some data in our zlib buffer, flush it out so we can return something. */ if (block == APR_BLOCK_READ && - APR_BRIGADE_EMPTY(ctx->proc_bb) && - ctx->stream.avail_out < c->bufferSize) { + APR_BRIGADE_EMPTY(ctx->proc_bb) && + ctx->stream.avail_out < c->bufferSize) { apr_bucket *tmp_heap; apr_size_t len; ctx->stream.next_out = ctx->buffer; @@ -1390,6 +1389,9 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, APR_BRIGADE_CONCAT(bb, ctx->proc_bb); apr_brigade_split_ex(bb, bkt, ctx->proc_bb); } + if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { + ap_remove_input_filter(f); + } } return APR_SUCCESS; -- 2.40.0