Skip to content

Commit 88e4784

Browse files
committed
Revert changes in 2.2.11 that caused an invalid
etag to be emitted for on-the-fly gzip content-encoding. PR 39727 will require larger fixes and this fix was far more harmful than the original code. PR: 45023, 39727 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@761835 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0dff419 commit 88e4784

2 files changed

Lines changed: 5 additions & 36 deletions

File tree

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
-*- coding: utf-8 -*-
22
Changes with Apache 2.2.12
33

4+
*) mod_deflate: revert changes in 2.2.11 that caused an invalid
5+
etag to be emitted for on-the-fly gzip content-encoding.
6+
PR 39727 will require larger fixes and this fix was far more
7+
harmful than the original code. PR 45023. [Roy T. Fielding]
8+
49
*) mod_disk_cache: The module now turns off sendfile support if
510
'EnableSendfile off' is defined globally. PR 41218.
611
[Lars Eilebrecht, Issac Goldstand]

modules/filters/mod_deflate.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -372,41 +372,7 @@ static apr_status_t deflate_ctx_cleanup(void *data)
372372
ctx->libz_end_func(&ctx->stream);
373373
return APR_SUCCESS;
374374
}
375-
/* ETag must be unique among the possible representations, so a change
376-
* to content-encoding requires a corresponding change to the ETag.
377-
* This routine appends -transform (e.g., -gzip) to the entity-tag
378-
* value inside the double-quotes if an ETag has already been set
379-
* and its value already contains double-quotes. PR 39727
380-
*/
381-
static void deflate_check_etag(request_rec *r, const char *transform)
382-
{
383-
const char *etag = apr_table_get(r->headers_out, "ETag");
384-
apr_size_t etaglen;
385-
386-
if ((etag && ((etaglen = strlen(etag)) > 2))) {
387-
if (etag[etaglen - 1] == '"') {
388-
apr_size_t transformlen = strlen(transform);
389-
char *newtag = apr_palloc(r->pool, etaglen + transformlen + 2);
390-
char *d = newtag;
391-
char *e = d + etaglen - 1;
392-
const char *s = etag;
393-
394-
for (; d < e; ++d, ++s) {
395-
*d = *s; /* copy etag to newtag up to last quote */
396-
}
397-
*d++ = '-'; /* append dash to newtag */
398-
s = transform;
399-
e = d + transformlen;
400-
for (; d < e; ++d, ++s) {
401-
*d = *s; /* copy transform to newtag */
402-
}
403-
*d++ = '"'; /* append quote to newtag */
404-
*d = '\0'; /* null terminate newtag */
405375

406-
apr_table_setn(r->headers_out, "ETag", newtag);
407-
}
408-
}
409-
}
410376
static apr_status_t deflate_out_filter(ap_filter_t *f,
411377
apr_bucket_brigade *bb)
412378
{
@@ -604,7 +570,6 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
604570
}
605571
apr_table_unset(r->headers_out, "Content-Length");
606572
apr_table_unset(r->headers_out, "Content-MD5");
607-
deflate_check_etag(r, "gzip");
608573

609574
/* initialize deflate output buffer */
610575
ctx->stream.next_out = ctx->buffer;
@@ -1097,7 +1062,6 @@ static apr_status_t inflate_out_filter(ap_filter_t *f,
10971062
/* these are unlikely to be set anyway, but ... */
10981063
apr_table_unset(r->headers_out, "Content-Length");
10991064
apr_table_unset(r->headers_out, "Content-MD5");
1100-
deflate_check_etag(r, "gunzip");
11011065

11021066
/* initialize inflate output buffer */
11031067
ctx->stream.next_out = ctx->buffer;

0 commit comments

Comments
 (0)