28extern module AP_MODULE_DECLARE_DATA cache_module;
51 if (
url->scheme ||
url->hostname) {
79 else if (filter->
hostname[0] ==
'*') {
103 const unsigned uport = (
url->port_str &&
url->port_str[0])
116 if (*filter->
path ==
'/' && pathlen == 1) {
159 newp->provider_name =
ent->type;
160 newp->provider = provider;
169 if (
last->provider == provider) {
174 if (
last->provider == provider) {
318 (
h->cache_obj !=
NULL) &&
319 (
h->cache_obj->key !=
NULL)) {
344 "Could not create a cache lock directory: %s",
356 "Could not stat a cache lock file: %s",
363 "Cache lock file for '%s' too old, removing: %s",
470 if (!
cache->control_in.parsed) {
477 if (
cache->control_in.no_cache) {
484 "Incoming request is asking for an uncached version of "
485 "%s, but we have been configured to ignore it and serve "
509 if (!
cache->control_in.parsed) {
516 if (
cache->control_in.no_store) {
524 "Incoming request is asking for a no-store version of "
525 "%s, but we have been configured to ignore it and serve "
589 if (
cache->control_in.no_cache) {
597 "Incoming request is asking for a uncached version of "
598 "%s, but we have been configured to ignore it and "
599 "serve a cached response anyway",
604 if (
h->cache_obj->info.control.no_cache
605 ||
h->cache_obj->info.control.invalidated) {
619 && endp >
agestr && !*endp) {
628 smaxage =
h->cache_obj->info.control.s_maxage_value;
661 if (
cache->control_in.max_stale) {
662 if (
cache->control_in.max_stale_value != -1) {
690 if (
maxstale && (
h->cache_obj->info.control.must_revalidate
691 ||
h->cache_obj->info.control.proxy_revalidate ||
smaxage != -1)) {
697 ((
smaxage == -1) && (maxage == -1) &&
709 if (!(((maxage != -1) &&
age < maxage) ||
716 "110 Response is stale");
726 h->resp_hdrs,
"Expires") ==
NULL) && (
age > 86400)) {
735 "113 Heuristic expiration");
775 "Cache lock obtained for stale cached URL, "
776 "revalidating entry: %s",
783 "Cache already locked for stale cached URL, "
784 "pretend it is fresh: %s",
792 "110 Response is stale");
800 "Attempt to obtain a cache lock for stale "
801 "cached URL failed, revalidating entry anyway: %s",
844 for (
i = 0, j = 0;
i <
sizeof(j) * 2;
i++) {
850 j |=
ch - (
'A' - 10);
852 j |=
ch - (
'a' - 10);
864 for (
i = (
sizeof(j) * 2)-1;
i >= 0;
i--) {
868 y[
i] =
ch + (
'A' - 10);
872 y[
sizeof(j) * 2] =
'\0';
883 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";
893 for (
i = 0, k = 0;
i < 15;
i += 3) {
914 val[
i + 22 - k] =
'\0';
918 int dirlength,
const char *
name)
973 if (**
last ==
'\"') {
977 else if (**
last ==
'\\') {
1012 cc->max_age_value = -1;
1013 cc->max_stale_value = -1;
1014 cc->min_fresh_value = -1;
1015 cc->s_maxage_value = -1;
1039 if (token[8] ==
'=') {
1042 else if (!token[8]) {
1059 && endp > token + 8 && !*endp) {
1061 cc->max_age_value =
offt;
1065 cc->must_revalidate = 1;
1070 && endp > token + 10 && !*endp) {
1072 cc->max_stale_value =
offt;
1074 else if (!token[9]) {
1076 cc->max_stale_value = -1;
1082 && endp > token + 10 && !*endp) {
1084 cc->min_fresh_value =
offt;
1102 if (token[7] ==
'=') {
1103 cc->private_header = 1;
1105 else if (!token[7]) {
1110 cc->proxy_revalidate = 1;
1119 && endp > token + 9 && !*endp) {
1121 cc->s_maxage_value =
offt;
1153 if (token[8] ==
'=') {
1169 if (token[7] ==
'=') {
1302 if (!state->
first) {
1316 *elt = state->
first;
1338 else if (!state.
merged) {
apr_size_t const unsigned char unsigned int unsigned int d
static int cache_table_getm_do(void *v, const char *key, const char *val)
static int cache_control_remove(request_rec *r, const char *cc_header, apr_table_t *headers)
static void cache_hash(const char *it, char *val, int ndepth, int nlength)
apr_OFN_ap_cache_generate_key_t * cache_generate_key
static int uri_meets_conditions(const apr_uri_t *filter, const apr_size_t pathlen, const apr_uri_t *url, const char *path)
static cache_provider_list * get_provider(request_rec *r, struct cache_enable *ent, cache_provider_list *providers)
apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
#define APLOG_USE_MODULE(foo)
#define ap_get_module_config(v, m)
request_rec int int apr_table_t const char * path
const char * ap_make_content_type(request_rec *r, const char *type)
void * ap_lookup_provider(const char *provider_group, const char *provider_name, const char *provider_version)
#define APR_STATUS_IS_EEXIST(s)
#define APR_STATUS_IS_ENOENT(s)
#define APR_BUCKET_NEXT(e)
#define APR_BRIGADE_SENTINEL(b)
#define APR_BUCKET_IS_EOS(e)
#define APR_BRIGADE_FIRST(b)
#define APR_OPTIONAL_FN_TYPE(name)
cache_provider_list * cache_get_providers(request_rec *r, cache_server_conf *conf)
char * cache_strqtok(char *str, const char *sep, char **last)
#define CACHE_LOCKFILE_KEY
apr_table_t * cache_merge_headers_out(request_rec *r)
int ap_cache_check_no_cache(cache_request_rec *cache, request_rec *r)
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)
int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache, request_rec *r)
#define CACHE_LOCKNAME_KEY
int ap_cache_check_no_store(cache_request_rec *cache, request_rec *r)
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)
int ap_cache_control(request_rec *r, cache_control_t *cc, const char *cc_header, const char *pragma_header, apr_table_t *headers)
const char * ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str)
#define CACHE_PROVIDER_GROUP
char * ap_cache_generate_name(apr_pool_t *p, int dirlevels, int dirlength, const char *name)
apr_table_t * ap_cache_cacheable_headers(apr_pool_t *pool, apr_table_t *t, server_rec *s)
apr_time_t ap_cache_hex2usec(const char *x)
#define CACHE_DECLARE(type)
void ap_cache_usec2hex(apr_time_t j, char *y)
apr_int64_t ap_cache_current_age(cache_info *info, const apr_time_t age_value, apr_time_t now)
apr_table_t * ap_cache_cacheable_headers_in(request_rec *r)
apr_table_t * ap_cache_cacheable_headers_out(request_rec *r)
int ap_cstr_casecmp(const char *s1, const char *s2)
#define ap_strstr_c(s, c)
#define ap_strchr_c(s, c)
int ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
const char int apr_pool_t * pool
const apr_array_header_t * list
int strcasecmp(const char *a, const char *b)
#define apr_pcalloc(p, size)
#define apr_time_sec(time)
#define apr_time_from_sec(sec)
Main include file for the Apache Transparent Cache.
static apr_status_t age(proxy_balancer *balancer, server_rec *s)
unsigned int no_cache_header
unsigned int no_transform
unsigned int cache_control
unsigned int only_if_cached
apr_array_header_t * cacheenable
cache_provider_list * next
unsigned int ignorecachecontrol
apr_array_header_t * ignore_headers
apr_array_header_t * cachedisable
apr_array_header_t * cacheenable
apr_array_header_t * merged
A structure that represents the current request.
const char * content_type
apr_table_t * err_headers_out
struct ap_conf_vector_t * per_dir_config
const char * content_encoding
apr_table_t * headers_out
A structure to store information for each virtual server.
struct ap_conf_vector_t * module_config
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray