From: Allan K. Edwards Date: Fri, 11 Jun 2004 19:44:23 +0000 (+0000) Subject: Don't deflate responses with zero length e.g. proxied 304's X-Git-Tag: pre_ajp_proxy~168 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fef2e7930807f3107d4c68bcef3566f03e21c266;p=apache Don't deflate responses with zero length e.g. proxied 304's git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103910 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index c9aab68e1d..4f87b0982e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_deflate: Don't deflate responses with zero length + e.g. proxied 304's [Allan Edwards] + *) now applies to all IP addresses for myhost instead of just the first one reported by the resolver. This corrects a regression since 1.3. [Jeff Trawick] diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index e63ba18c4c..c2af498b58 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -255,6 +255,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, * we're in better shape. */ if (!ctx) { + int eos_only = 1; + apr_bucket *bkt; char *buf, *token; const char *encoding; @@ -370,6 +372,21 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, return ap_pass_brigade(f->next, bb); } } + + /* don't deflate responses with zero length e.g. proxied 304's */ + for (bkt = APR_BRIGADE_FIRST(bb); + bkt != APR_BRIGADE_SENTINEL(bb); + bkt = APR_BUCKET_NEXT(bkt)) + { + if (!APR_BUCKET_IS_EOS(bkt)) { + eos_only = 0; + break; + } + } + if (eos_only) { + return ap_pass_brigade(f->next, bb); + } + /* We're cool with filtering this. */ ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx)); ctx->bb = apr_brigade_create(r->pool, f->c->bucket_alloc);