]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Check all sources of Content-Encoding in inflate_out filter
authorNick Kew <niq@apache.org>
Mon, 6 Aug 2007 22:45:39 +0000 (22:45 +0000)
committerNick Kew <niq@apache.org>
Mon, 6 Aug 2007 22:45:39 +0000 (22:45 +0000)
PR 42993
Reasoning: http://marc.info/?l=apache-httpd-dev&m=118643107831358&w=2

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

CHANGES
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index 8caf79e509b7fb775e980373520ff62e248fe7df..375410afdcc20763bca6ad044dc156ef5d0ad426 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mod_deflate: fix content_encoding detection in inflate_out filter
+     when it's not in response headers table.
+     PR 42993 [Nick Kew]
+
   *) mod_proxy: Improve network performance by setting APR_TCP_NODELAY
      (disable Nagle algorithm) on sockets if implemented.
      PR 42871 [Christian BOITEL <christian_boitel yahoo.fr>, Jim Jagielski]
index 98ecd3b72c3f9e70d91a8205706d6b7390a021f8..cca3742f7379d6a78803d415b35522d7769b7ab1 100644 (file)
@@ -88,10 +88,18 @@ static const char deflate_magic[2] = { '\037', '\213' };
  * If a request has multiple encodings, we need the gzip
  * to be the outermost non-identity encoding.
  */
-static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs)
+static int check_gzip(apr_pool_t *pool, apr_table_t *hdrs,
+                      apr_table_t *hdrs2, const char *enc_in)
 {
     int found = 0;
     const char *encoding = apr_table_get(hdrs, "Content-Encoding");
+
+    if (!encoding && (hdrs2 != NULL)) {
+        encoding = apr_table_get(hdrs2, "Content-Encoding");
+    }
+    if (!encoding) {
+        encoding = enc_in;
+    }
     if (encoding && *encoding) {
 
         /* check the usual/simple case first */
@@ -735,7 +743,7 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
          *
          * If not, we just remove ourself.
          */
-        if (check_gzip(r->pool, r->headers_in) == 0) {
+        if (check_gzip(r->pool, r->headers_in, NULL, NULL) == 0) {
             ap_remove_input_filter(f);
             return ap_get_brigade(f->next, bb, mode, block, readbytes);
         }
@@ -990,7 +998,8 @@ static apr_status_t inflate_out_filter(ap_filter_t *f,
          * Let's see what our current Content-Encoding is.
          * Only inflate if gzipped.
          */
-        if (check_gzip(r->pool, r->headers_out) == 0) {
+        if (check_gzip(r->pool, r->headers_out, r->err_headers_out,
+                       r->content_encoding) == 0) {
             ap_remove_output_filter(f);
             return ap_pass_brigade(f->next, bb);
         }