]> granicus.if.org Git - apache/commitdiff
Don't deflate responses with zero length e.g. proxied 304's
authorAllan K. Edwards <ake@apache.org>
Fri, 11 Jun 2004 19:44:23 +0000 (19:44 +0000)
committerAllan K. Edwards <ake@apache.org>
Fri, 11 Jun 2004 19:44:23 +0000 (19:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103910 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index c9aab68e1d09811089175e51a4f6e68fb8abdcb3..4f87b0982ef34685ea9efc247ac9d971859c3715 100644 (file)
--- 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]
+
   *) <VirtualHost myhost> 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]
index e63ba18c4c76b98b78c867647012f46a489a65ca..c2af498b58a5c21d450b9e701c39d88aa3727ef8 100644 (file)
@@ -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);