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 ]
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)
{
}
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;
/* 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;