You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2003/09/17 12:39:43 UTC

cvs commit: httpd-2.0/modules/filters mod_deflate.c

trawick     2003/09/17 03:39:43

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES STATUS
               modules/filters Tag: APACHE_2_0_BRANCH mod_deflate.c
  Log:
  merge this fix from 2.1-dev:
  
      * Fix mod_deflate not to search somewhere in the memory for the "gzip"
        token and to skip token parameters. PR 21523.
        Don't compress if there was *any* non-identity endoding applied before.
  
  PR:               21523
  Submitted by:	  Joe Orton, André Malo
  Reviewed by:	  striker, trawick
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.988.2.155 +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.154
  retrieving revision 1.988.2.155
  diff -u -r1.988.2.154 -r1.988.2.155
  --- CHANGES	17 Sep 2003 10:30:46 -0000	1.988.2.154
  +++ CHANGES	17 Sep 2003 10:39:43 -0000	1.988.2.155
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0.48
   
  +  *) 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]
  +
     *) Avoid an infinite recursion, which occured if the name of an included
        config file or directory contained a wildcard character. PR 22194.
        [Andr� Malo]
  
  
  
  1.751.2.474 +1 -7      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.473
  retrieving revision 1.751.2.474
  diff -u -r1.751.2.473 -r1.751.2.474
  --- STATUS	17 Sep 2003 10:30:46 -0000	1.751.2.473
  +++ STATUS	17 Sep 2003 10:39:43 -0000	1.751.2.474
  @@ -289,12 +289,6 @@
           modules/mappers/mod_rewrite.c: r1.228
         +1: nd
   
  -    * Fix mod_deflate not to search somewhere in the memory for the "gzip"
  -      token and to skip token parameters. PR 21523.
  -      Don't compress if there was *any* non-identity endoding applied before.
  -        modules/filters/mod_deflate.c: r1.37, r1.38
  -      +1: nd, striker, trawick, jorton
  -
       * Fix mod_log_config's %b format to write "-" in case of bytes_sent == 0.
           modules/loggers/mod_log_config.c: r1.106
         +1: nd, jorton
  
  
  
  No                   revision
  No                   revision
  1.26.2.8  +23 -8     httpd-2.0/modules/filters/mod_deflate.c
  
  Index: mod_deflate.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_deflate.c,v
  retrieving revision 1.26.2.7
  retrieving revision 1.26.2.8
  diff -u -r1.26.2.7 -r1.26.2.8
  --- mod_deflate.c	13 Aug 2003 21:14:13 -0000	1.26.2.7
  +++ mod_deflate.c	17 Sep 2003 10:39:43 -0000	1.26.2.8
  @@ -325,7 +325,8 @@
           }
   
           /* 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 @@
               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;
               }
           }
   
  @@ -376,9 +383,17 @@
   
           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. */