-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_cache: Don't add cached/revalidated entity headers to a 304 response.
+ PR 55547. [Yann Ylavic]
+
*) mod_cache: Retry unconditional request with the full URL (including the
query-string) when the origin server's 304 response does not match the
conditions used to revalidate the stale entry. [Yann Ylavic].
static ap_filter_rec_t *cache_remove_url_filter_handle;
static ap_filter_rec_t *cache_invalidate_filter_handle;
+/**
+ * Entity headers' names
+ */
+static const char *MOD_CACHE_ENTITY_HEADERS[] = {
+ "Allow",
+ "Content-Encoding",
+ "Content-Language",
+ "Content-Length",
+ "Content-Location",
+ "Content-MD5",
+ "Content-Range",
+ "Content-Type",
+ "Last-Modified",
+ NULL
+};
+
/*
* CACHE handler
* -------------
apr_time_t exp, date, lastmod, now;
apr_off_t size = -1;
cache_info *info = NULL;
- const char *reason;
+ const char *reason, **eh;
apr_pool_t *p;
apr_bucket *e;
apr_table_t *headers;
* inconsistencies between cached entity-bodies and updated headers.
*/
if (r->status == HTTP_NOT_MODIFIED) {
- apr_table_unset(r->headers_out, "Allow");
- apr_table_unset(r->headers_out, "Content-Encoding");
- apr_table_unset(r->headers_out, "Content-Language");
- apr_table_unset(r->headers_out, "Content-Length");
- apr_table_unset(r->headers_out, "Content-MD5");
- apr_table_unset(r->headers_out, "Content-Range");
- apr_table_unset(r->headers_out, "Content-Type");
- apr_table_unset(r->headers_out, "Last-Modified");
+ for (eh = MOD_CACHE_ENTITY_HEADERS; *eh; ++eh) {
+ apr_table_unset(r->headers_out, *eh);
+ }
}
/* Hold the phone. Some servers might allow us to cache a 2xx, but
if (status != OK) {
r->status = status;
+ /* Strip the entity headers merged from the cached headers before
+ * updating the entry (see cache_accept_headers() above).
+ */
+ for (eh = MOD_CACHE_ENTITY_HEADERS; *eh; ++eh) {
+ apr_table_unset(r->headers_out, *eh);
+ }
+
bkt = apr_bucket_flush_create(bb->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, bkt);
}