/[Apache-SVN]/httpd/httpd/trunk/modules/filters/mod_deflate.c
ViewVC logotype

Diff of /httpd/httpd/trunk/modules/filters/mod_deflate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- httpd/httpd/trunk/modules/filters/mod_deflate.c	2007/10/02 11:48:03	581198
+++ httpd/httpd/trunk/modules/filters/mod_deflate.c	2007/12/28 12:03:20	607219
@@ -373,25 +373,20 @@
     return APR_SUCCESS;
 }
 /* PR 39727: we're screwing up our clients if we leave a strong ETag
- * header while transforming content.  A minimal fix that makes us
- * protocol-compliant is to make it a weak ETag.  Whether we can
- * use this ourselves (e.g. in mod_cache) is a different issue.
+ * header while transforming content.  Henrik Nordstrom suggests
+ * appending ";gzip".
  *
- * Henrik Nordstrom suggests instead appending ";gzip", commenting:
- *   "This should allows for easy bidirectional mapping, simplifying most
- *   conditionals as no transformation of the entity body is needed to find
- *   the etag, and the simple format makes it easier to trace should any
- *   misunderstandings occur."
- *
- * We might consider such a strategy in future if we implement support
- * for such a scheme.
+ * Pending a more thorough review of our Etag handling, let's just
+ * implement his suggestion.  It fixes the bug, or at least turns it
+ * from a showstopper to an inefficiency.  And it breaks nothing that
+ * wasn't already broken.
  */
-static void deflate_check_etag(request_rec *r)
+static void deflate_check_etag(request_rec *r, const char *transform)
 {
     const char *etag = apr_table_get(r->headers_out, "ETag");
     if (etag && (((etag[0] != 'W') && (etag[0] !='w')) || (etag[1] != '/'))) {
         apr_table_set(r->headers_out, "ETag",
-                      apr_pstrcat(r->pool, "W/", etag, NULL));
+                      apr_pstrcat(r->pool, etag, "-", transform, NULL));
     }
 }
 static apr_status_t deflate_out_filter(ap_filter_t *f,
@@ -591,7 +586,7 @@
         }
         apr_table_unset(r->headers_out, "Content-Length");
         apr_table_unset(r->headers_out, "Content-MD5");
-        deflate_check_etag(r);
+        deflate_check_etag(r, "gzip");
 
         /* initialize deflate output buffer */
         ctx->stream.next_out = ctx->buffer;
@@ -1084,7 +1079,7 @@
         /* 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);
+        deflate_check_etag(r, "gunzip");
 
         /* initialize inflate output buffer */
         ctx->stream.next_out = ctx->buffer;

 

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2