You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2007/07/30 14:24:50 UTC

svn commit: r560937 - /httpd/httpd/trunk/modules/filters/mod_deflate.c

Author: niq
Date: Mon Jul 30 05:24:49 2007
New Revision: 560937

URL: http://svn.apache.org/viewvc?view=rev&rev=560937
Log:
Be liberal and correct in what we accept

Modified:
    httpd/httpd/trunk/modules/filters/mod_deflate.c

Modified: httpd/httpd/trunk/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?view=diff&rev=560937&r1=560936&r2=560937
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_deflate.c Mon Jul 30 05:24:49 2007
@@ -37,6 +37,7 @@
 #include "httpd.h"
 #include "http_config.h"
 #include "http_log.h"
+#include "apr_lib.h"
 #include "apr_strings.h"
 #include "apr_general.h"
 #include "util_filter.h"
@@ -680,27 +681,31 @@
                 found = 1;
                 apr_table_unset(r->headers_in, "Content-Encoding");
             }
-            else if (ap_strchr_c(encoding, ':') != NULL) {
+            else if (ap_strchr_c(encoding, ',') != NULL) {
                 /* If the outermost encoding isn't gzip, there's nowt
                  * we can do.  So only check the last non-identity token
                  */
                 char *new_encoding = apr_pstrdup(r->pool, encoding);
+                char *ptr;
                 for(;;) {
-                    token = ap_strrchr(new_encoding, ':');
+                    token = ap_strrchr(new_encoding, ',');
                     if (!token) {        /* gzip:identity or other:identity */
-                        if (!strcasecmp(new_encoding, "gzip")) {
+                        if (!strcasecmp(new_encoding, "gzip")
+                            || !strcasecmp(new_encoding, "x-gzip")) {
                             apr_table_unset(r->headers_in, "Content-Encoding");
                             found = 1;
                         }
                         break; /* seen all tokens */
                     }
-                    if (!strcasecmp(token+sizeof(char), "gzip")) {
+                    for (ptr=token+1; apr_isspace(*ptr); ++ptr);
+                    if (!strcasecmp(ptr, "gzip")
+                        || !strcasecmp(ptr, "x-gzip")) {
                         *token = '\0';
                         apr_table_setn(r->headers_in, "Content-Encoding",
                                        new_encoding);
                         found = 1;
                     }
-                    else if (!strcasecmp(token+sizeof(char), "identity")) {
+                    else if (!strcasecmp(ptr, "identity")) {
                         *token = '\0';
                         continue; /* strip the token and find the next one */
                     }



Re: svn commit: r560937 - /httpd/httpd/trunk/modules/filters/mod_deflate.c

Posted by Nick Kew <ni...@webthing.com>.
On Mon, 30 Jul 2007 18:02:34 -0500
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:

> >              }
> > -            else if (ap_strchr_c(encoding, ':') != NULL) {
> > +            else if (ap_strchr_c(encoding, ',') != NULL) {
> 
> Uhm - so blowing away q val logic?

Huh?  You lost me.

> Actually, that doesn't look like a semi, that looks like a colon which
> has no meaning I can think of, offhand.  What was that about, before?

It came from a tired misreading of section 14:11 of rfc2616.
Specifically the separately-quoted colon in the line
  Content-Encoding = "Content-Encoding" ":" 1#content-coding

(also from having no recollection of ever having seen more
than one token in a real-life Content-Encoding).

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: svn commit: r560937 - /httpd/httpd/trunk/modules/filters/mod_deflate.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
niq@apache.org wrote:
>              }
> -            else if (ap_strchr_c(encoding, ':') != NULL) {
> +            else if (ap_strchr_c(encoding, ',') != NULL) {

Uhm - so blowing away q val logic?

Actually, that doesn't look like a semi, that looks like a colon which
has no meaning I can think of, offhand.  What was that about, before?

Bill

Re: svn commit: r560937 - /httpd/httpd/trunk/modules/filters/mod_deflate.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
niq@apache.org wrote:
>              }
> -            else if (ap_strchr_c(encoding, ':') != NULL) {
> +            else if (ap_strchr_c(encoding, ',') != NULL) {

Uhm - so blowing away q val logic?

Actually, that doesn't look like a semi, that looks like a colon which
has no meaning I can think of, offhand.  What was that about, before?

Bill