| 372 |
ctx->libz_end_func(&ctx->stream); |
ctx->libz_end_func(&ctx->stream); |
| 373 |
return APR_SUCCESS; |
return APR_SUCCESS; |
| 374 |
} |
} |
| 375 |
|
/* PR 39727: we're screwing up our clients if we leave a strong ETag |
| 376 |
|
* header while transforming content. A minimal fix that makes us |
| 377 |
|
* protocol-compliant is to make it a weak ETag. Whether we can |
| 378 |
|
* use this ourselves (e.g. in mod_cache) is a different issue. |
| 379 |
|
* |
| 380 |
|
* Henrik Nordstrom suggests instead appending ";gzip", commenting: |
| 381 |
|
* "This should allows for easy bidirectional mapping, simplifying most |
| 382 |
|
* conditionals as no transformation of the entity body is needed to find |
| 383 |
|
* the etag, and the simple format makes it easier to trace should any |
| 384 |
|
* misunderstandings occur." |
| 385 |
|
* |
| 386 |
|
* We might consider such a strategy in future if we implement support |
| 387 |
|
* for such a scheme. |
| 388 |
|
*/ |
| 389 |
|
static void deflate_check_etag(request_rec *r) |
| 390 |
|
{ |
| 391 |
|
const char *etag = apr_table_get(r->headers_out, "ETag"); |
| 392 |
|
if (etag && (((etag[0] != 'W') && (etag[0] !='w')) || (etag[1] != '/'))) { |
| 393 |
|
apr_table_set(r->headers_out, "ETag", |
| 394 |
|
apr_pstrcat(r->pool, "W/", etag, NULL)); |
| 395 |
|
} |
| 396 |
|
} |
| 397 |
static apr_status_t deflate_out_filter(ap_filter_t *f, |
static apr_status_t deflate_out_filter(ap_filter_t *f, |
| 398 |
apr_bucket_brigade *bb) |
apr_bucket_brigade *bb) |
| 399 |
{ |
{ |
| 591 |
} |
} |
| 592 |
apr_table_unset(r->headers_out, "Content-Length"); |
apr_table_unset(r->headers_out, "Content-Length"); |
| 593 |
apr_table_unset(r->headers_out, "Content-MD5"); |
apr_table_unset(r->headers_out, "Content-MD5"); |
| 594 |
|
deflate_check_etag(r); |
| 595 |
|
|
| 596 |
/* initialize deflate output buffer */ |
/* initialize deflate output buffer */ |
| 597 |
ctx->stream.next_out = ctx->buffer; |
ctx->stream.next_out = ctx->buffer; |
| 1084 |
/* these are unlikely to be set anyway, but ... */ |
/* these are unlikely to be set anyway, but ... */ |
| 1085 |
apr_table_unset(r->headers_out, "Content-Length"); |
apr_table_unset(r->headers_out, "Content-Length"); |
| 1086 |
apr_table_unset(r->headers_out, "Content-MD5"); |
apr_table_unset(r->headers_out, "Content-MD5"); |
| 1087 |
|
deflate_check_etag(r); |
| 1088 |
|
|
| 1089 |
/* initialize inflate output buffer */ |
/* initialize inflate output buffer */ |
| 1090 |
ctx->stream.next_out = ctx->buffer; |
ctx->stream.next_out = ctx->buffer; |