From: Lars Eilebrecht Date: Mon, 2 Feb 2009 23:20:37 +0000 (+0000) Subject: mod_deflate: Fix creation of invalid Etag headers. We now make sure X-Git-Tag: 2.3.2~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f41fcf0ba41e7289744f58f4fec7c435790bc917;p=thirdparty%2Fapache%2Fhttpd.git 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@740149 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 24f9810b283..0c7952dc775 100644 --- 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] diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index b18fa311fa2..1266d90c3fc 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -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)