]> granicus.if.org Git - apache/commitdiff
Fix headers in deflate_out_filter for the case of an empty first brigade
authorNick Kew <niq@apache.org>
Sat, 17 Jul 2004 14:14:11 +0000 (14:14 +0000)
committerNick Kew <niq@apache.org>
Sat, 17 Jul 2004 14:14:11 +0000 (14:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104314 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_deflate.c

index 90ec67368cc49d9d3e1377b10ee6ace873ee6925..8856e62fe237cf89ded05307f8a67dbf885ab32f 100644 (file)
@@ -382,7 +382,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             }
         }
 
-        /* don't deflate responses with zero length e.g. proxied 304's */
+        /* don't deflate responses with zero length e.g. proxied 304's but
+         * we do set the header on eos_only at this point for headers_filter
+         */
         for (bkt = APR_BRIGADE_FIRST(bb);
              bkt != APR_BRIGADE_SENTINEL(bb);
              bkt = APR_BUCKET_NEXT(bkt))
@@ -393,6 +395,13 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             }
         }
         if (eos_only) {
+            if (!encoding || !strcasecmp(encoding, "identity")) {
+                apr_table_set(r->headers_out, "Content-Encoding", "gzip");
+            }
+            else {
+                apr_table_merge(r->headers_out, "Content-Encoding", "gzip");
+            }
+            apr_table_unset(r->headers_out, "Content-Length");
             return ap_pass_brigade(f->next, bb);
         }