From: Justin Erenkrantz Date: Fri, 14 Jun 2002 07:58:34 +0000 (+0000) Subject: Modify the deflate input filter so that it should always return data on a X-Git-Tag: 2.0.38~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37d8495d4d48e2d3c3c13a3a4fc3ed2613f46a0a;p=apache Modify the deflate input filter so that it should always return data on a blocking read. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95666 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 4d0016e212..5a0b525bdd 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -720,10 +720,29 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, eos); break; } + } apr_brigade_cleanup(ctx->bb); } + /* If we are about to return nothing for a 'blocking' read and we have + * 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_bucket *tmp_heap; + apr_size_t len; + ctx->stream.next_out = ctx->buffer; + len = c->bufferSize - ctx->stream.avail_out; + + ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len); + tmp_heap = apr_bucket_heap_create((char *)ctx->buffer, len, + NULL, f->c->bucket_alloc); + APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, tmp_heap); + ctx->stream.avail_out = c->bufferSize; + } + if (!APR_BRIGADE_EMPTY(ctx->proc_bb)) { apr_bucket_brigade *newbb;