*
* RFC2616 13.6 and 14.44 describe the Vary mechanism.
*/
- vary = ap_pstrdup(r->pool, ap_table_get(r->headers_out, "Vary"));
+ vary = apr_pstrdup(r->pool, apr_table_get(r->headers_out, "Vary"));
while (vary && *vary) {
char *name = vary;
const char *h1, *h2;
/* isolate header name */
- while (*vary && !ap_isspace(*vary) && (*vary != ','))
+ while (*vary && !apr_isspace(*vary) && (*vary != ','))
++vary;
- while (*vary && (ap_isspace(*vary) || (*vary == ','))) {
+ while (*vary && (apr_isspace(*vary) || (*vary == ','))) {
*vary = '\0';
++vary;
}
* is this header in the request and the header in the cached
* request identical? If not, we give up and do a straight get
*/
- h1 = ap_table_get(r->headers_in, name);
- h2 = ap_table_get(h->req_hdrs, name);
+ h1 = apr_table_get(r->headers_in, name);
+ h2 = apr_table_get(h->req_hdrs, name);
if (h1 == h2) {
/* both headers NULL, so a match - do nothing */
}
* entity, and it's value is in the past, it has expired.
*
*/
- cc_cresp = ap_table_get(r->headers_out, "Cache-Control");
- cc_req = ap_table_get(r->headers_in, "Cache-Control");
- pragma_cresp = ap_table_get(r->headers_out, "Pragma"); /* TODO: pragma_cresp not being used? */
- if ((agestr = ap_table_get(r->headers_out, "Age"))) {
+ cc_cresp = apr_table_get(r->headers_out, "Cache-Control");
+ cc_req = apr_table_get(r->headers_in, "Cache-Control");
+ /* TODO: pragma_cresp not being used? */
+ pragma_cresp = apr_table_get(r->headers_out, "Pragma");
+ if ((agestr = apr_table_get(r->headers_out, "Age"))) {
age_c = atoi(agestr);
}
(info->expire != APR_DATE_BAD && age < (info->expire - info->date + maxstale - minfresh))) {
/* it's fresh darlings... */
/* set age header on response */
- ap_table_set(r->headers_out, "Age",
- ap_psprintf(r->pool, "%lu", (unsigned long)age));
+ apr_table_set(r->headers_out, "Age",
+ apr_psprintf(r->pool, "%lu", (unsigned long)age));
/* add warning if maxstale overrode freshness calculation */
if (!((-1 < smaxage && age < smaxage) ||
(-1 < maxage && age < maxage) ||
(info->expire != APR_DATE_BAD && (info->expire - info->date) > age))) {
/* make sure we don't stomp on a previous warning */
- ap_table_merge(r->headers_out, "Warning", "110 Response is stale");
+ apr_table_merge(r->headers_out, "Warning", "110 Response is stale");
}
return 1; /* Cache object is fresh */
}
i = p - list;
do
p++;
- while (ap_isspace(*p));
+ while (apr_isspace(*p));
}
else
i = strlen(list);
- while (i > 0 && ap_isspace(list[i - 1]))
+ while (i > 0 && apr_isspace(list[i - 1]))
i--;
if (i == len && strncasecmp(list, key, len) == 0) {
if (val) {
p = strchr((char *) list, ',');
- while (ap_isspace(*list)) {
+ while (apr_isspace(*list)) {
list++;
}
if ('=' == list[0])
list++;
- while (ap_isspace(*list)) {
+ while (apr_isspace(*list)) {
list++;
}
strncpy(valbuf, list, MIN(p-list, sizeof(valbuf)-1));
cache = (cache_request_rec *) ap_get_module_config(r->request_config,
&cache_module);
if (!cache) {
- cache = ap_pcalloc(r->pool, sizeof(cache_request_rec));
+ cache = apr_pcalloc(r->pool, sizeof(cache_request_rec));
ap_set_module_config(r->request_config, &cache_module, cache);
}
int rv;
request_rec *r = f->r;
char *url = r->unparsed_uri;
- const char *cc_out = ap_table_get(r->headers_out, "Cache-Control");
+ const char *cc_out = apr_table_get(r->headers_out, "Cache-Control");
const char *exps, *lastmods, *dates, *etag;
apr_time_t exp, date, lastmod, now;
apr_size_t size;
* other than the cache handler
*/
if (!cache) {
- cache = ap_pcalloc(r->pool, sizeof(cache_request_rec));
+ cache = apr_pcalloc(r->pool, sizeof(cache_request_rec));
ap_set_module_config(r->request_config, &cache_module, cache);
}
* and decides whether this URL should be cached at all. This section is
* run before the above section.
*/
- info = ap_pcalloc(r->pool, sizeof(cache_info));
+ info = apr_pcalloc(r->pool, sizeof(cache_info));
/* read expiry date; if a bad date, then leave it so the client can
* read it
*/
- exps = ap_table_get(r->headers_out, "Expires");
+ exps = apr_table_get(r->headers_out, "Expires");
if (exps != NULL) {
if (APR_DATE_BAD == (exp = apr_date_parse_http(exps))) {
exps = NULL;
}
/* read the last-modified date; if the date is bad, then delete it */
- lastmods = ap_table_get(r->headers_out, "Last-Modified");
+ lastmods = apr_table_get(r->headers_out, "Last-Modified");
if (lastmods != NULL) {
if (APR_DATE_BAD == (lastmod = apr_date_parse_http(lastmods))) {
lastmods = NULL;
}
/* read the etag from the entity */
- etag = ap_table_get(r->headers_out, "Etag");
+ etag = apr_table_get(r->headers_out, "Etag");
/*
* what responses should we not cache?
* 2) If Cache-Control: must-revalidate is included
* 3) If Cache-Control: public is included
*/
- (ap_table_get(r->headers_in, "Authorization") != NULL &&
+ (apr_table_get(r->headers_in, "Authorization") != NULL &&
!(ap_cache_liststr(cc_out, "s-maxage", NULL) ||
ap_cache_liststr(cc_out, "must-revalidate", NULL) ||
ap_cache_liststr(cc_out, "public", NULL))
*/
/* Read the date. Generate one if one is not supplied */
- dates = ap_table_get(r->headers_out, "Date");
+ dates = apr_table_get(r->headers_out, "Date");
if (dates != NULL)
info->date = apr_date_parse_http(dates);
else
date = now;
dates = apr_pcalloc(r->pool, MAX_STRING_LEN);
apr_rfc822_date(dates, now);
- ap_table_set(r->headers_out, "Date", dates);
+ apr_table_set(r->headers_out, "Date", dates);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cache: Added date header");
info->date = date;
static void * create_cache_config(apr_pool_t *p, server_rec *s)
{
- cache_server_conf *ps = ap_pcalloc(p, sizeof(cache_server_conf));
+ cache_server_conf *ps = apr_pcalloc(p, sizeof(cache_server_conf));
/* 1 if the cache is enabled, 0 otherwise */
ps->cacheon = 0;
ps->cacheon_set = 0;
/* array of URL prefixes for which caching is enabled */
- ps->cacheenable = ap_make_array(p, 10, sizeof(struct cache_enable));
+ ps->cacheenable = apr_array_make(p, 10, sizeof(struct cache_enable));
/* array of URL prefixes for which caching is disabled */
- ps->cachedisable = ap_make_array(p, 10, sizeof(struct cache_disable));
+ ps->cachedisable = apr_array_make(p, 10, sizeof(struct cache_disable));
/* maximum time to cache a document */
ps->maxex = DEFAULT_CACHE_MAXEXPIRE;
ps->maxex_set = 0;
static void * merge_cache_config(apr_pool_t *p, void *basev, void *overridesv)
{
- cache_server_conf *ps = ap_pcalloc(p, sizeof(cache_server_conf));
+ cache_server_conf *ps = apr_pcalloc(p, sizeof(cache_server_conf));
cache_server_conf *base = (cache_server_conf *) basev;
cache_server_conf *overrides = (cache_server_conf *) overridesv;
ps->cacheon =
(overrides->cacheon_set == 0) ? base->cacheon : overrides->cacheon;
/* array of URL prefixes for which caching is disabled */
- ps->cachedisable = ap_append_arrays(p,
+ ps->cachedisable = apr_array_append(p,
base->cachedisable,
overrides->cachedisable);
/* array of URL prefixes for which caching is enabled */
- ps->cacheenable = ap_append_arrays(p,
+ ps->cacheenable = apr_array_append(p,
base->cacheenable,
overrides->cacheenable);
/* maximum time to cache a document */