You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by fi...@apache.org on 2009/04/04 01:16:03 UTC

svn commit: r761835 - in /httpd/httpd/branches/2.2.x: CHANGES modules/filters/mod_deflate.c

Author: fielding
Date: Fri Apr  3 23:16:03 2009
New Revision: 761835

URL: http://svn.apache.org/viewvc?rev=761835&view=rev
Log:
Revert changes in 2.2.11 that caused an invalid
etag to be emitted for on-the-fly gzip content-encoding.
PR 39727 will require larger fixes and this fix was far more
harmful than the original code.

PR: 45023, 39727

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=761835&r1=761834&r2=761835&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri Apr  3 23:16:03 2009
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.12
   
+  *) mod_deflate: revert changes in 2.2.11 that caused an invalid
+     etag to be emitted for on-the-fly gzip content-encoding.
+     PR 39727 will require larger fixes and this fix was far more
+     harmful than the original code. PR 45023. [Roy T. Fielding]
+
   *) mod_disk_cache: The module now turns off sendfile support if
      'EnableSendfile off' is defined globally. PR 41218.
      [Lars Eilebrecht, Issac Goldstand]

Modified: httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c?rev=761835&r1=761834&r2=761835&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/branches/2.2.x/modules/filters/mod_deflate.c Fri Apr  3 23:16:03 2009
@@ -372,41 +372,7 @@
         ctx->libz_end_func(&ctx->stream);
     return APR_SUCCESS;
 }
-/* ETag must be unique among the possible representations, so a change
- * to content-encoding requires a corresponding change to the ETag.
- * This routine appends -transform (e.g., -gzip) to the entity-tag
- * value inside the double-quotes if an ETag has already been set
- * and its value already contains double-quotes. PR 39727
- */
-static void deflate_check_etag(request_rec *r, const char *transform)
-{
-    const char *etag = apr_table_get(r->headers_out, "ETag");
-    apr_size_t etaglen;
-
-    if ((etag && ((etaglen = strlen(etag)) > 2))) {
-        if (etag[etaglen - 1] == '"') {
-            apr_size_t transformlen = strlen(transform);
-            char *newtag = apr_palloc(r->pool, etaglen + transformlen + 2);
-            char *d = newtag;
-            char *e = d + etaglen - 1;
-            const char *s = etag;
-
-            for (; d < e; ++d, ++s) {
-                *d = *s;          /* copy etag to newtag up to last quote */
-            }
-            *d++ = '-';           /* append dash to newtag */
-            s = transform;
-            e = d + transformlen;
-            for (; d < e; ++d, ++s) {
-                *d = *s;          /* copy transform to newtag */
-            }
-            *d++ = '"';           /* append quote to newtag */
-            *d   = '\0';          /* null terminate newtag */
 
-            apr_table_setn(r->headers_out, "ETag", newtag);
-        }
-    }   
-}
 static apr_status_t deflate_out_filter(ap_filter_t *f,
                                        apr_bucket_brigade *bb)
 {
@@ -604,7 +570,6 @@
         }
         apr_table_unset(r->headers_out, "Content-Length");
         apr_table_unset(r->headers_out, "Content-MD5");
-        deflate_check_etag(r, "gzip");
 
         /* initialize deflate output buffer */
         ctx->stream.next_out = ctx->buffer;
@@ -1097,7 +1062,6 @@
         /* these are unlikely to be set anyway, but ... */
         apr_table_unset(r->headers_out, "Content-Length");
         apr_table_unset(r->headers_out, "Content-MD5");
-        deflate_check_etag(r, "gunzip");
 
         /* initialize inflate output buffer */
         ctx->stream.next_out = ctx->buffer;