Bug 19913

Summary: mod_deflate: "r->content_encoding" should be checked
Product: Apache httpd-2 Reporter: Tsuyoshi SASAMOTO <nazonazo>
Component: mod_deflateAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: CLOSED FIXED    
Severity: minor    
Priority: P3    
Version: 2.0-HEAD   
Target Milestone: ---   
Hardware: PC   
OS: Solaris   

Description Tsuyoshi SASAMOTO 2003-05-14 07:09:22 UTC
"r->content_encoding" should be checked to avoid compressing a compressed file,
when an internal redirection occurs by mod_negotiation/mod_rewrite,
or "*.{html,txt,etc}.gz" is requested directly.

--- httpd-2.0/modules/filters/mod_deflate.c     Wed Mar 12 03:11:33 2003
+++ httpd-2.0/modules/filters/mod_deflate.c     Wed May 14 14:55:40 2003
@@ -340,6 +340,12 @@
             encoding = apr_table_get(r->err_headers_out, "Content-Encoding");
         }
 
+        if (r->content_encoding) {
+            encoding = encoding ? apr_pstrcat(r->pool, encoding, ",",
+                                              r->content_encoding, NULL)
+                                : r->content_encoding;
+        }
+
         if (encoding) {
             const char *tmp = encoding;
Comment 1 André Malo 2003-05-16 23:16:00 UTC
Yes, you're right. I've just committed your patch and proposed it for backport
into the stable branch.

Thanks for your report and thanks for using Apache.