]> granicus.if.org Git - apache/commitdiff
Doh. If Accept-Encoding contains no gzip token, we skip the 0 delimiter
authorAndré Malo <nd@apache.org>
Tue, 19 Aug 2003 12:26:38 +0000 (12:26 +0000)
committerAndré Malo <nd@apache.org>
Tue, 19 Aug 2003 12:26:38 +0000 (12:26 +0000)
and search for "gzip" somehwere in the memory. This was originally discovered
by Joe Orton. But there's more. We must skip any parameters, since these
do not contain what we're looking for.

PR: 21523

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

CHANGES
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index 522976361c3f79548fb305dd6ff97ad3bdd82593..745785f51c0e70698377e5164e3e732979d7cf84 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Fix a bug, where mod_deflate sometimes unconditionally compressed the
+     content if the Accept-Encoding header contained only other tokens than
+     "gzip" (such as "deflate"). PR 21523.  [Joe Orton, André Malo]
+
   *) mod_rewrite: Catch an edge case, where strange subsequent RewriteRules
      could lead to a 400 (Bad Request) response.  [André Malo]
 
index 3730b5685b089cf72ac859c19e56a9d9f8243e6d..d02431c014830e362c1ea6983feefea4bf6e31e8 100644 (file)
@@ -376,9 +376,17 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
 
         token = ap_get_token(r->pool, &accepts, 0);
         while (token && token[0] && strcasecmp(token, "gzip")) {
-            /* skip token */
-            accepts++;
-            token = ap_get_token(r->pool, &accepts, 0);
+            /* skip parameters, XXX: ;q=foo evaluation? */
+            while (*accepts == ';') { 
+                ++accepts;
+                token = ap_get_token(r->pool, &accepts, 1);
+            }
+
+            /* retrieve next token */
+            if (*accepts == ',') {
+                ++accepts;
+            }
+            token = (*accepts) ? ap_get_token(r->pool, &accepts, 0) : NULL;
         }
 
         /* No acceptable token found. */