From d39f516f05a0ff37b298e454799c70e98c21e74f Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Mon, 13 May 2002 07:11:01 +0000 Subject: [PATCH] Fix mod_deflate corruption when using multiple input buckets. We should only clear *_out when we are the beginning or avail_out == 0. Justin was tracking this down before he went to WWDC and didn't finish before he left. A (virtual) beer goes to Asada who filed this PR with the right patch! PR: 9014 Submitted by: kaz@asada.sytes.net (ASADA Kazuhisa) Reviewed by: Justin Erenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95055 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/filters/mod_deflate.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 30ed3771ed..be866a5dc7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.37 + *) Fix mod_deflate corruption when using multiple buckets. PR 9014. + [Asada Kazuhisa ] + *) Performance enhancements for access logger when using default timestamp formatting [Brian Pane] diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 658ce925aa..343f05971a 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -326,6 +326,10 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, apr_table_setn(r->headers_out, "Vary", "Accept-Encoding"); apr_table_unset(r->headers_out, "Content-Length"); } + + /* initialize deflate output buffer */ + ctx->stream.next_out = ctx->buffer; + ctx->stream.avail_out = c->bufferSize; APR_BRIGADE_FOREACH(e, bb) { const char *data; @@ -436,8 +440,6 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, * but we'll just have to * trust zlib */ ctx->stream.avail_in = len; - ctx->stream.next_out = ctx->buffer; - ctx->stream.avail_out = c->bufferSize; while (ctx->stream.avail_in != 0) { if (ctx->stream.avail_out == 0) { -- 2.40.0