From: André Malo Date: Tue, 19 Aug 2003 12:26:38 +0000 (+0000) Subject: Doh. If Accept-Encoding contains no gzip token, we skip the 0 delimiter X-Git-Tag: pre_ajp_proxy~1262 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee9b0e8d5e778b0e1a12ab50a0a6eaae3d776d5c;p=apache Doh. If Accept-Encoding contains no gzip token, we skip the 0 delimiter 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 --- diff --git a/CHANGES b/CHANGES index 522976361c..745785f51c 100644 --- 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] diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 3730b5685b..d02431c014 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -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. */