From: Jim Jagielski Date: Fri, 4 Jan 2008 14:23:50 +0000 (+0000) Subject: And final patch before tag X-Git-Tag: 2.2.7~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7a9abd884a5772fc601f5a9f44c2ebcbbdde9f5;p=thirdparty%2Fapache%2Fhttpd.git And final patch before tag git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@608849 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 8db9fd19fa7..fde3885b85b 100644 --- a/STATUS +++ b/STATUS @@ -80,11 +80,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_deflate: Don't leave a strong ETag in place when transforming content - PR 39727 - http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?r1=580598&r2=607219&pathrev=607219 - +1: niq, wrowe, jim - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 07ca194f97d..de1a57d78a3 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -372,7 +372,23 @@ static apr_status_t deflate_ctx_cleanup(void *data) ctx->libz_end_func(&ctx->stream); return APR_SUCCESS; } - +/* PR 39727: we're screwing up our clients if we leave a strong ETag + * header while transforming content. Henrik Nordstrom suggests + * appending ";gzip". + * + * 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, 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)); + } +} static apr_status_t deflate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) { @@ -570,6 +586,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, } 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; @@ -1062,6 +1079,7 @@ static apr_status_t inflate_out_filter(ap_filter_t *f, /* 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;