]> granicus.if.org Git - apache/commitdiff
* modules/filters/mod_deflate.c (deflate_out_filter): Check explicitly
authorJoe Orton <jorton@apache.org>
Thu, 2 Dec 2004 13:45:32 +0000 (13:45 +0000)
committerJoe Orton <jorton@apache.org>
Thu, 2 Dec 2004 13:45:32 +0000 (13:45 +0000)
for a 304 or 204 response rather than a brigade which begins with EOS,
to correctly handle such responses when generated by a CGI script.
Don't alter the headers for this case either.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@109500 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_deflate.c

index 5b16371b0625426042d7747acc852053954221e7..550b514ae8b6a408fd092ad0c5e2f1a54fa50a53 100644 (file)
@@ -350,19 +350,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             }
         }
 
-        /* Deflating a zero-length response would make it longer; the
-         * proxy may pass through an empty response for a 304 too.
-         * So we just need to fix up the headers as if we had a body.
-         */
-        if (APR_BUCKET_IS_EOS(APR_BRIGADE_FIRST(bb))) {
-            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");
-
+        /* For a 304 or 204 response there is no entity included in
+         * the response and hence nothing to deflate. */
+        if (r->status == HTTP_NOT_MODIFIED || r->status == HTTP_NO_CONTENT) {
             ap_remove_output_filter(f);
             return ap_pass_brigade(f->next, bb);
         }