mirror of
https://github.com/apache/httpd.git
synced 2025-11-05 05:30:39 +03:00
mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
take precedence if present. PR 35247. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1069942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
Changes with Apache 2.3.11
|
Changes with Apache 2.3.11
|
||||||
|
|
||||||
*) mod_ssl: Fix a possible startup failure if multiple SSL vhosts
|
*) mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
|
||||||
are configured with the same ServerName and private key file.
|
take precedence if present. PR 35247. [Graham Leggett]
|
||||||
[Masahiro Matsuya <mmatsuya redhat.com>, Joe Orton]
|
|
||||||
|
|
||||||
*) mod_socache_dc: Make module compile by fixing some typos.
|
*) mod_socache_dc: Make module compile by fixing some typos.
|
||||||
PR 50735 [Mark Montague <mark catseye.org>]
|
PR 50735 [Mark Montague <mark catseye.org>]
|
||||||
|
|||||||
20
modules/cache/cache_util.c
vendored
20
modules/cache/cache_util.c
vendored
@@ -540,8 +540,16 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
|
|||||||
maxage_req = cache->control_in.max_age_value;
|
maxage_req = cache->control_in.max_age_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* extract max-age from response */
|
/*
|
||||||
|
* extract max-age from response, if both s-maxage and max-age, s-maxage
|
||||||
|
* takes priority
|
||||||
|
*/
|
||||||
|
if (smaxage != -1) {
|
||||||
|
maxage_cresp = smaxage;
|
||||||
|
}
|
||||||
|
else {
|
||||||
maxage_cresp = h->cache_obj->info.control.max_age_value;
|
maxage_cresp = h->cache_obj->info.control.max_age_value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if both maxage request and response, the smaller one takes priority
|
* if both maxage request and response, the smaller one takes priority
|
||||||
@@ -585,15 +593,14 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
|
|||||||
minfresh = 0;
|
minfresh = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override maxstale if must-revalidate or proxy-revalidate */
|
/* override maxstale if must-revalidate, proxy-revalidate or s-maxage */
|
||||||
if (maxstale && (h->cache_obj->info.control.must_revalidate
|
if (maxstale && (h->cache_obj->info.control.must_revalidate
|
||||||
|| h->cache_obj->info.control.proxy_revalidate)) {
|
|| h->cache_obj->info.control.proxy_revalidate || smaxage != -1)) {
|
||||||
maxstale = 0;
|
maxstale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle expiration */
|
/* handle expiration */
|
||||||
if (((smaxage != -1) && (age < (smaxage - minfresh))) ||
|
if (((maxage != -1) && (age < (maxage + maxstale - minfresh))) ||
|
||||||
((maxage != -1) && (age < (maxage + maxstale - minfresh))) ||
|
|
||||||
((smaxage == -1) && (maxage == -1) &&
|
((smaxage == -1) && (maxage == -1) &&
|
||||||
(info->expire != APR_DATE_BAD) &&
|
(info->expire != APR_DATE_BAD) &&
|
||||||
(age < (apr_time_sec(info->expire - info->date) + maxstale - minfresh)))) {
|
(age < (apr_time_sec(info->expire - info->date) + maxstale - minfresh)))) {
|
||||||
@@ -606,8 +613,7 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
|
|||||||
apr_psprintf(r->pool, "%lu", (unsigned long)age));
|
apr_psprintf(r->pool, "%lu", (unsigned long)age));
|
||||||
|
|
||||||
/* add warning if maxstale overrode freshness calculation */
|
/* add warning if maxstale overrode freshness calculation */
|
||||||
if (!(((smaxage != -1) && age < smaxage) ||
|
if (!(((maxage != -1) && age < maxage) ||
|
||||||
((maxage != -1) && age < maxage) ||
|
|
||||||
(info->expire != APR_DATE_BAD &&
|
(info->expire != APR_DATE_BAD &&
|
||||||
(apr_time_sec(info->expire - info->date)) > age))) {
|
(apr_time_sec(info->expire - info->date)) > age))) {
|
||||||
/* make sure we don't stomp on a previous warning */
|
/* make sure we don't stomp on a previous warning */
|
||||||
|
|||||||
Reference in New Issue
Block a user