22module AP_MODULE_DECLARE_DATA cache_module;
116 cache->providers = providers;
144 "PUT/POST/DELETE: Adding CACHE_INVALIDATE filter for %s",
201 r,
APLOGNO(00749)
"Adding CACHE_SAVE_SUBREQ filter for %s",
209 r,
APLOGNO(00750)
"Adding CACHE_SAVE filter for %s",
219 "Adding CACHE_REMOVE_URL filter for %s",
235 r,
APLOGNO(00752)
"Cache locked for url, not caching "
236 "response: %s",
r->
uri);
238 if (
cache->stale_headers) {
245 if (
cache->stale_headers) {
247 r,
APLOGNO(00753)
"Restoring request headers for %s",
268 if (
cache->stale_headers) {
270 "Restoring request headers.");
337 "cache_quick_handler(%s): ap_pass_brigade returned",
338 cache->provider_name);
353 while (next && next->
frec !=
stop) {
354 if (next->
frec == from) {
426 cache->providers = providers;
444 "PUT/POST/DELETE: Adding CACHE_INVALIDATE filter for %s",
500 r,
APLOGNO(00756)
"Adding CACHE_SAVE_SUBREQ filter for %s",
506 r,
APLOGNO(00757)
"Adding CACHE_SAVE filter for %s",
529 r,
APLOGNO(00758)
"Replacing CACHE with CACHE_SAVE "
530 "filter for %s",
r->
uri);
540 "Adding CACHE_REMOVE_URL filter for %s",
549 cache->remove_url_filter
557 r,
APLOGNO(00760)
"Cache locked for url, not caching "
558 "response: %s",
r->
uri);
605 r,
APLOGNO(00761)
"Replacing CACHE with CACHE_OUT filter for %s",
632 cache->provider_name);
650 "CACHE/CACHE_OUT filter enabled while caching is disabled, ignoring");
656 "cache: running CACHE_OUT filter");
683 "cache: serving %s",
r->
uri);
718 "cache: Cache provider's store_body failed for URI %s",
f->r->uri);
736 rv =
cache->provider->commit_entity(
cache->handle,
f->r);
756 "cache: Cache provider's store_body returned an "
757 "empty brigade, but didn't consume all of the "
758 "input brigade, standing down to prevent a spin");
837 "CACHE/CACHE_SAVE filter enabled while caching is disabled, ignoring");
850 if (
cache->block_response) {
860 if (
cache->in_checked) {
889 if (
cache->stale_handle
890 && !
cache->stale_handle->cache_obj->info.control.must_revalidate
891 && !
cache->stale_handle->cache_obj->info.control.proxy_revalidate) {
908 cache->stale_handle->resp_hdrs,
"Content-Type"));
915 "111 Revalidation failed");
920 "cache hit: %d status; stale content returned",
992 cache->stale_handle->resp_hdrs,
"Content-Type"));
1050 else if (!control.s_maxage && !control.
max_age
1056 reason =
"Expires header already expired; not cacheable";
1059 || control.proxy_revalidate) && (!control.s_maxage_value
1060 || (!control.s_maxage && !control.max_age_value)) &&
lastmods
1064 =
"s-maxage or max-age zero and no Last-Modified or Etag; not cacheable";
1067 && !control.
max_age && !control.s_maxage) {
1071 reason =
"Query string present but no explicit expiration time";
1078 reason =
"HTTP Status 304 Not Modified";
1082 && !control.s_maxage) {
1090 reason =
"No Last-Modified; Etag; Expires; Cache-Control:max-age or Cache-Control:s-maxage headers";
1097 reason =
"Cache-Control: no-store present";
1104 reason =
"Cache-Control: private present";
1107 && !(control.s_maxage || control.must_revalidate
1108 || control.proxy_revalidate || control.public)) {
1116 reason =
"Authorization required";
1119 reason =
"Vary header contains '*'";
1122 reason =
"environment variable 'no-cache' is set";
1126 reason =
"r->no_cache present";
1128 else if (
cache->stale_handle
1140 reason =
"updated entity is older than cached entity";
1144 "cache: Removing CACHE_REMOVE_URL filter.");
1165 "but ",
ehs,
" modified",
NULL);
1198 "cache: %s responded with an uncacheable 304, "
1199 "retrying the request %s. Reason: %s",
1205 "conditional cache miss: 304 was uncacheable, entity removed: %s",
1239 reason =
"invalid content length";
1244 "cache: %s not cached for request %s. Reason: %s",
1262 cache->in_checked = 1;
1309 if (
cache->stale_handle) {
1318 cache->provider->remove_entity(
cache->stale_handle);
1331 if (!
cache->handle) {
1341 "cache miss: cache unwilling to store response");
1350 "cache: Caching url %s for request %s",
1357 "cache: Removing CACHE_REMOVE_URL filter.");
1403 r,
APLOGNO(00771)
"cache: Last modified is in the future, "
1404 "replacing with now");
1409 if (control.s_maxage || control.
max_age) {
1412 x = control.s_maxage ? control.s_maxage_value : control.max_age_value;
1418 if (x > dconf->
maxex) {
1446 if (x > dconf->
maxex) {
1452 exp = date + dconf->
defex;
1458 if (
cache->stale_handle) {
1477 cache->handle->resp_hdrs, 1);
1495 if (
cache->stale_handle) {
1508 rv =
cache->provider->commit_entity(
cache->handle,
r);
1539 cache->block_response = 1;
1548 "cache: updating headers with store_headers failed. "
1549 "Removing cached url.");
1551 rv =
cache->provider->remove_url(
cache->stale_handle,
r);
1557 "cache: attempt to remove url from cache unsuccessful.");
1563 "conditional cache hit: entity refresh failed");
1571 "conditional cache hit: entity refreshed");
1579 "cache: serving %s (revalidated)",
r->
uri);
1586 "cache: store_headers failed");
1590 "cache miss: store_headers failed");
1599 "cache miss: attempting entity save");
1641 "cache: CACHE_REMOVE_URL enabled unexpectedly");
1686 "cache: CACHE_INVALIDATE enabled unexpectedly: %s",
r->
uri);
1693 "cache: response status to '%s' method is %d (>299), not invalidating cached entity: %s",
r->
method,
r->
status,
r->
uri);
1699 "cache: Invalidating all cached entities in response to '%s' request for %s",
1707 "cache invalidated by %s",
r->
method));
1746 "cache: CACHE filter was added in quick handler mode and "
1747 "will be ignored: %s",
f->r->unparsed_uri);
1752 "cache: CACHE filter was added twice, or was added where "
1753 "the cache has been bypassed and will be ignored: %s",
1754 f->r->unparsed_uri);
1785 int x_cache = 0, x_cache_detail = 0;
1828 if (x_cache_detail) {
1874 if (
cache->stale_handle &&
cache->save_filter
1875 && !
cache->stale_handle->cache_obj->info.control.must_revalidate
1876 && !
cache->stale_handle->cache_obj->info.control.proxy_revalidate
1877 && !
cache->stale_handle->cache_obj->info.control.s_maxage) {
1904 "111 Revalidation failed");
1914 "cache hit: %d status; stale content returned",
1992 ||
base->x_cache_detail_set;
1997 ||
base->stale_on_error_set;
2017 ps->ignorecachecontrol = 0;
2018 ps->ignorecachecontrol_set = 0;
2023 ps->ignorequerystring = 0;
2024 ps->ignorequerystring_set = 0;
2058 ps->ignorecachecontrol =
2059 (
overrides->ignorecachecontrol_set == 0)
2060 ?
base->ignorecachecontrol
2062 ps->ignore_headers =
2064 ?
base->ignore_headers
2066 ps->ignorequerystring =
2068 ?
base->ignorequerystring
2070 ps->ignore_session_id =
2072 ?
base->ignore_session_id
2094 ps->x_cache_detail =
2096 ?
base->x_cache_detail
2194 (*new) = (
char *)header;
2245 "provider (%s) starts with a '/'. Are url and provider switched?",
2254 "CacheEnable provider (%s) is missing an URL.",
type);
2257 return "When in a Location, CacheEnable must specify a path or an URL below "
2277 if (
new->url.path) {
2278 new->pathlen = strlen(
new->url.path);
2281 new->url.path =
"/";
2310 return "CacheDisable must be followed by the word 'on' when in a Location.";
2315 return "CacheDisable must specify a path or an URL.";
2322 if (
new->url.path) {
2323 new->pathlen = strlen(
new->url.path);
2326 new->url.path =
"/";
2368 return "CacheLastModifiedFactor value must be a float";
2430 return "CacheLockMaxAge value must be a non-zero positive integer";
2499 return apr_psprintf(
parms->pool,
"URL '%s' must contain at least one of a scheme, a hostname or a port.",
arg);
2541 "A cache type and partial URL prefix below which "
2542 "caching is enabled"),
2544 "A partial URL prefix below which caching is disabled"),
2546 "The maximum time in seconds to cache a document"),
2548 "The minimum time in seconds to cache a document"),
2550 "The default time in seconds to cache a document"),
2553 "Run the cache in the quick handler, default on"),
2556 "Ignore Responses where there is no Last Modified Header"),
2559 "Ignore requests from the client for uncached content"),
2562 "Ignore expiration dates when populating cache, resulting in "
2563 "an If-Modified-Since request to the backend on retrieval"),
2566 "Ignore 'Cache-Control: private' and store private content"),
2569 "Ignore 'Cache-Control: no-store' and store sensitive content"),
2571 "A space separated list of headers that should not be "
2572 "stored by the cache"),
2575 "Ignore query-string when caching"),
2578 "identifiers that should be ignored for creating the key "
2579 "of the cached entity."),
2581 "The factor used to estimate Expires date from "
2582 "LastModified date"),
2585 "Enable or disable the thundering herd lock."),
2587 "The thundering herd lock path. Defaults to the '"
2591 "Maximum age of any thundering herd lock."),
2593 "Add a X-Cache header to responses. Default is off."),
2596 "Add a X-Cache-Detail header to responses. Default is off."),
2598 "Override the base URL of reverse proxied cache keys."),
2601 "Serve stale content on 5xx errors if present. Defaults to on."),
apr_array_append(apr_pool_t *p, const apr_array_header_t *first, const apr_array_header_t *second)
#define CACHE_IGNORE_SESSION_ID_UNSET
#define CACHE_IGNORE_SESSION_ID_SET
#define CACHE_IGNORE_HEADERS_UNSET
#define CACHE_IGNORE_HEADERS_SET
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_DECLARE_MODULE(foo)
void ap_hook_quick_handler(ap_HOOK_quick_handler_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
void ap_hook_handler(ap_HOOK_handler_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)
const char server_rec server_rec ** ps
ap_filter_rec_t * ap_get_input_filter_handle(const char *name)
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
ap_filter_rec_t * ap_register_output_filter(const char *name, ap_out_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype)
apr_status_t ap_pass_brigade_fchk(request_rec *r, apr_bucket_brigade *bucket, const char *fmt,...) __attribute__((format(printf
ap_filter_t * ap_add_output_filter_handle(ap_filter_rec_t *f, void *ctx, request_rec *r, conn_rec *c)
void ap_remove_output_filter(ap_filter_t *f)
int ap_meets_conditions(request_rec *r)
void ap_hook_insert_error_filter(ap_HOOK_insert_error_filter_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_set_content_type(request_rec *r, const char *ct)
void ap_internal_redirect(const char *new_uri, request_rec *r)
void ap_run_insert_filter(request_rec *r)
#define APR_BUCKET_IS_FLUSH(e)
#define APR_BRIGADE_PREPEND(a, b)
#define APR_BRIGADE_INSERT_TAIL(b, e)
#define APR_BUCKET_NEXT(e)
#define APR_BRIGADE_EMPTY(b)
#define APR_BRIGADE_SENTINEL(b)
#define apr_bucket_delete(e)
#define APR_BUCKET_IS_EOS(e)
#define APR_BRIGADE_FIRST(b)
apr_pool_t apr_dbd_t const char * query
#define APR_HOOK_LINK(name)
#define APR_HOOK_STRUCT(members)
#define APR_HOOK_REALLY_FIRST
#define APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ns, link, ret, name, args_decl, args_use, ok, decline)
#define APR_RETRIEVE_OPTIONAL_FN(name)
#define APR_OPTIONAL_FN_TYPE(name)
int cache_remove_url(cache_request_rec *cache, request_rec *r)
void cache_accept_headers(cache_handle_t *h, request_rec *r, apr_table_t *top, apr_table_t *bottom, int revalidation)
int cache_invalidate(cache_request_rec *cache, request_rec *r)
apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t *p, const char **key)
int cache_create_entity(cache_request_rec *cache, request_rec *r, apr_off_t size, apr_bucket_brigade *in)
int cache_select(cache_request_rec *cache, request_rec *r)
cache_provider_list * cache_get_providers(request_rec *r, cache_server_conf *conf)
#define DEFAULT_CACHE_MINEXPIRE
#define DEFAULT_CACHE_LMFACTOR
#define DEFAULT_CACHE_EXPIRE
apr_table_t * cache_merge_headers_out(request_rec *r)
#define DEFAULT_X_CACHE_DETAIL
const char * cache_table_getm(apr_pool_t *p, const apr_table_t *t, const char *key)
apr_status_t cache_remove_lock(cache_server_conf *conf, cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb)
#define DEFAULT_CACHE_LOCKPATH
#define DEFAULT_CACHE_MAXAGE
int ap_cache_check_no_store(cache_request_rec *cache, request_rec *r)
#define DEFAULT_CACHE_STALE_ON_ERROR
#define DEFAULT_CACHE_MAXEXPIRE
int cache_use_early_url(request_rec *r)
apr_status_t cache_try_lock(cache_server_conf *conf, cache_request_rec *cache, request_rec *r)
#define HTTP_MULTIPLE_CHOICES
#define HTTP_NOT_MODIFIED
#define HTTP_INTERNAL_SERVER_ERROR
#define HTTP_PARTIAL_CONTENT
#define HTTP_MOVED_PERMANENTLY
#define HTTP_NON_AUTHORITATIVE
int cache_run_cache_status(cache_handle_t *h, request_rec *r, apr_table_t *headers, ap_cache_status_e status, const char *reason)
int ap_cache_control(request_rec *r, cache_control_t *cc, const char *cc_header, const char *pragma_header, apr_table_t *headers)
#define AP_CACHE_STATUS_ENV
#define AP_CACHE_INVALIDATE_ENV
#define AP_CACHE_MISS_ENV
void cache_hook_cache_status(cache_HOOK_cache_status_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_CACHE_REVALIDATE_ENV
#define STANDARD20_MODULE_STUFF
#define ap_strstr_c(s, c)
#define ap_strchr_c(s, c)
int ap_find_token(apr_pool_t *p, const char *line, const char *tok)
int ap_parse_strict_length(apr_off_t *len, const char *str)
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
const char int apr_pool_t * pool
const char apr_int32_t flag
int strcasecmp(const char *a, const char *b)
const apr_hash_t const apr_hash_t * h2
#define apr_pcalloc(p, size)
apr_int32_t apr_int32_t apr_int32_t err
#define apr_time_from_sec(sec)
static void * merge_cache_config(apr_pool_t *p, void *basev, void *overridesv)
static const char * set_cache_maxex(cmd_parms *parms, void *dummy, const char *arg)
static ap_filter_rec_t * cache_remove_url_filter_handle
static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
static ap_filter_rec_t * cache_out_filter_handle
static const char * set_cache_factor(cmd_parms *parms, void *dummy, const char *arg)
static void * create_dir_config(apr_pool_t *p, char *dummy)
static const char * set_cache_ignore_no_last_mod(cmd_parms *parms, void *dummy, int flag)
static const char * set_cache_minex(cmd_parms *parms, void *dummy, const char *arg)
static const char * add_ignore_header(cmd_parms *parms, void *dummy, const char *header)
static const char * add_cache_enable(cmd_parms *parms, void *dummy, const char *type, const char *url)
static const char * add_ignore_session_id(cmd_parms *parms, void *dummy, const char *identifier)
static apr_status_t cache_invalidate_filter(ap_filter_t *f, apr_bucket_brigade *in)
static const char * set_cache_store_private(cmd_parms *parms, void *dummy, int flag)
static ap_filter_rec_t * cache_filter_handle
static const char * set_cache_defex(cmd_parms *parms, void *dummy, const char *arg)
static void * merge_dir_config(apr_pool_t *p, void *basev, void *addv)
static const char * set_cache_x_cache(cmd_parms *parms, void *dummy, int flag)
static const char * set_cache_x_cache_detail(cmd_parms *parms, void *dummy, int flag)
static const char * set_cache_store_expired(cmd_parms *parms, void *dummy, int flag)
static int cache_handler(request_rec *r)
static ap_filter_rec_t * cache_save_subreq_filter_handle
static const char * set_cache_lock(cmd_parms *parms, void *dummy, int flag)
static int cache_status(cache_handle_t *h, request_rec *r, apr_table_t *headers, ap_cache_status_e status, const char *reason)
static void register_hooks(apr_pool_t *p)
static ap_filter_rec_t * cache_save_filter_handle
static const command_rec cache_cmds[]
static ap_filter_t * cache_get_filter(ap_filter_t *next, ap_filter_rec_t *rec)
static const char * set_cache_ignore_cachecontrol(cmd_parms *parms, void *dummy, int flag)
static int cache_save_store(ap_filter_t *f, apr_bucket_brigade *in, cache_server_conf *conf, cache_request_rec *cache)
apr_OFN_ap_cache_generate_key_t * cache_generate_key
static const char * set_cache_stale_on_error(cmd_parms *parms, void *dummy, int flag)
static int cache_replace_filter(ap_filter_t *next, ap_filter_rec_t *from, ap_filter_rec_t *to, ap_filter_rec_t *stop)
static apr_status_t cache_remove_url_filter(ap_filter_t *f, apr_bucket_brigade *in)
static const char * MOD_CACHE_ENTITY_HEADERS[]
static const char * set_cache_store_nostore(cmd_parms *parms, void *dummy, int flag)
static const char * set_cache_key_base_url(cmd_parms *parms, void *dummy, const char *arg)
static apr_status_t cache_out_filter(ap_filter_t *f, apr_bucket_brigade *in)
static void * create_cache_config(apr_pool_t *p, server_rec *s)
static apr_status_t cache_filter(ap_filter_t *f, apr_bucket_brigade *in)
static void cache_insert_error_filter(request_rec *r)
static const char * set_cache_quick_handler(cmd_parms *parms, void *dummy, int flag)
static const char * set_cache_lock_maxage(cmd_parms *parms, void *dummy, const char *arg)
static ap_filter_rec_t * cache_out_subreq_filter_handle
static const char * add_cache_disable(cmd_parms *parms, void *dummy, const char *url)
static int cache_quick_handler(request_rec *r, int lookup)
static const char * set_cache_lock_path(cmd_parms *parms, void *dummy, const char *arg)
static int cache_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
static const char * set_cache_ignore_querystring(cmd_parms *parms, void *dummy, int flag)
static ap_filter_rec_t * cache_invalidate_filter_handle
static int cache_header_cmp(apr_pool_t *pool, apr_table_t *left, apr_table_t *right, const char *key)
Main include file for the Apache Transparent Cache.
This structure is used for recording information about the registered filters. It associates a name w...
The representation of a filter chain.
apr_bucket_alloc_t * bucket_alloc
unsigned int store_nostore_set
apr_array_header_t * cacheenable
unsigned int store_private
unsigned int store_private_set
unsigned int no_last_mod_ignore
unsigned int store_expired
unsigned int store_nostore
unsigned int store_expired_set
unsigned int stale_on_error_set
unsigned int stale_on_error
unsigned int no_last_mod_ignore_set
unsigned int x_cache_detail
unsigned int x_cache_detail_set
unsigned int x_cache_detail_set
unsigned int ignorequerystring
unsigned int ignorecachecontrol
unsigned int ignore_session_id_set
unsigned int ignorequerystring_set
unsigned int ignore_headers_set
unsigned int lockpath_set
apr_array_header_t * ignore_headers
apr_array_header_t * cachedisable
unsigned int ignorecachecontrol_set
apr_array_header_t * ignore_session_id
unsigned int lockmaxage_set
apr_array_header_t * cacheenable
unsigned int base_uri_set
unsigned int x_cache_detail
struct apr_bucket_alloc_t * bucket_alloc
A structure that represents the current request.
struct ap_filter_t * output_filters
apr_table_t * err_headers_out
apr_table_t * subprocess_env
struct ap_conf_vector_t * per_dir_config
apr_table_t * headers_out
A structure to store information for each virtual server.
struct ap_conf_vector_t * module_config
static NAMED * lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize)