mirror of
https://github.com/apache/httpd.git
synced 2025-11-05 05:30:39 +03:00
Support Cache-Control: only-if-cached, as per RFC2616 14.9.4.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
18
modules/cache/cache_storage.c
vendored
18
modules/cache/cache_storage.c
vendored
@@ -304,6 +304,15 @@ int cache_select(cache_request_rec *cache, request_rec *r)
|
|||||||
if (!fresh) {
|
if (!fresh) {
|
||||||
const char *etag, *lastmod;
|
const char *etag, *lastmod;
|
||||||
|
|
||||||
|
/* Cache-Control: only-if-cached and revalidation required, try
|
||||||
|
* the next provider
|
||||||
|
*/
|
||||||
|
if (cache->control_in.only_if_cached) {
|
||||||
|
/* try again with next cache type */
|
||||||
|
list = list->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
|
||||||
"Cached response for %s isn't fresh. Adding/replacing "
|
"Cached response for %s isn't fresh. Adding/replacing "
|
||||||
"conditional request headers.", r->uri);
|
"conditional request headers.", r->uri);
|
||||||
@@ -387,6 +396,15 @@ int cache_select(cache_request_rec *cache, request_rec *r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if Cache-Control: only-if-cached, and not cached, return 504 */
|
||||||
|
if (cache->control_in.only_if_cached) {
|
||||||
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
|
||||||
|
"cache: 'only-if-cached' requested and no cached entity, "
|
||||||
|
"returning 504 Gateway Timeout for: %s", r->uri);
|
||||||
|
return HTTP_GATEWAY_TIME_OUT;
|
||||||
|
}
|
||||||
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
modules/cache/mod_cache.c
vendored
8
modules/cache/mod_cache.c
vendored
@@ -199,9 +199,7 @@ static int cache_quick_handler(request_rec *r, int lookup)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* error */
|
/* error */
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
return rv;
|
||||||
"cache: error returned while checking for cached "
|
|
||||||
"file by '%s' cache", cache->provider_name);
|
|
||||||
}
|
}
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
@@ -478,9 +476,7 @@ static int cache_handler(request_rec *r)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* error */
|
/* error */
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
return rv;
|
||||||
"cache: error returned while checking for cached "
|
|
||||||
"file by %s cache", cache->provider_name);
|
|
||||||
}
|
}
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user