]> granicus.if.org Git - apache/commitdiff
mod_deflate: Fix creation of invalid Etag headers. We now make sure
authorLars Eilebrecht <lars@apache.org>
Mon, 2 Feb 2009 23:20:37 +0000 (23:20 +0000)
committerLars Eilebrecht <lars@apache.org>
Mon, 2 Feb 2009 23:20:37 +0000 (23:20 +0000)
that the Etag value is properly quoted when adding the gzip marker.
PR 39727.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@740149 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index 24f9810b2838d3b22a6511100392a3740ec731a0..0c7952dc775907814f5ba48ff8f14e692b1f72b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.2
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_deflate: Fix creation of invalid Etag headers. We now make sure
+     that the Etag value is properly quoted when adding the gzip marker.
+     PR 39727. [Lars Eilebrecht]
+
   *) Added 20x22 icons for ODF, SVG, and XML documents.  PR 37185.
      [Peter Harlow]
 
index b18fa311fa203beac0c5874f276178f85f23f3cb..1266d90c3fc6755f56a9194dbb12351b0ad0f5c6 100644 (file)
@@ -393,10 +393,13 @@ static apr_status_t deflate_ctx_cleanup(void *data)
 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, etag, "-", transform, NULL));
-    }
+    if ((etag && (strlen(etag) > 2))) {
+        if (etag[0] == '"') {
+            etag = apr_pstrndup(r->pool, etag, strlen(etag) - 2);
+            apr_table_set(r->headers_out, "ETag",
+                          apr_pstrcat(r->pool, etag, "-", transform, "\"", NULL));
+        }
+    }   
 }
 static apr_status_t deflate_out_filter(ap_filter_t *f,
                                        apr_bucket_brigade *bb)