From: André Malo Date: Tue, 19 Aug 2003 14:56:12 +0000 (+0000) Subject: here applies the same. Don't skip the \0 delimiter when searching X-Git-Tag: pre_ajp_proxy~1261 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b1518c5d698eba136edb8359b2fd442fdeb2f03;p=apache here applies the same. Don't skip the \0 delimiter when searching for already applied encodings. Additionally don't compress if *any* non-identity encoding was applied before. (deflate, pkzip, whatever). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101019 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index d02431c014..74d3c03974 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -325,7 +325,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, } /* Let's see what our current Content-Encoding is. - * If gzip is present, don't gzip again. (We could, but let's not.) + * If it's already encoded, don't compress again. + * (We could, but let's not.) */ encoding = apr_table_get(r->headers_out, "Content-Encoding"); if (encoding) { @@ -350,14 +351,20 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, const char *tmp = encoding; token = ap_get_token(r->pool, &tmp, 0); - while (token && token[0]) { - if (!strcasecmp(token, "gzip")) { + while (token && *token) { + /* stolen from mod_negotiation: */ + if (strcmp(token, "identity") && strcmp(token, "7bit") && + strcmp(token, "8bit") && strcmp(token, "binary")) { + ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } + /* Otherwise, skip token */ - tmp++; - token = ap_get_token(r->pool, &tmp, 0); + if (*tmp) { + ++tmp; + } + token = (*tmp) ? ap_get_token(r->pool, &tmp, 0) : NULL; } }