From 8d42ec65c4fddd61d439c307752a505199ad4404 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Sun, 23 Jun 2002 06:10:00 +0000 Subject: [PATCH] No crutches. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95856 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/cache_storage.c | 10 ++++----- modules/experimental/cache_util.c | 23 ++++++++++---------- modules/experimental/mod_cache.c | 32 ++++++++++++++-------------- modules/experimental/mod_cache.h | 1 - 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/modules/experimental/cache_storage.c b/modules/experimental/cache_storage.c index f0911d55ca..b4b0d77d39 100644 --- a/modules/experimental/cache_storage.c +++ b/modules/experimental/cache_storage.c @@ -209,15 +209,15 @@ int cache_select_url(request_rec *r, const char *types, char *url) * * 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; } @@ -226,8 +226,8 @@ int cache_select_url(request_rec *r, const char *types, char *url) * 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 */ } diff --git a/modules/experimental/cache_util.c b/modules/experimental/cache_util.c index fd23926bfb..19262afaa4 100644 --- a/modules/experimental/cache_util.c +++ b/modules/experimental/cache_util.c @@ -194,10 +194,11 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_request_rec *cache, * 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); } @@ -256,15 +257,15 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_request_rec *cache, (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 */ } @@ -291,22 +292,22 @@ CACHE_DECLARE(int) ap_cache_liststr(const char *list, const char *key, char **va 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)); diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index e1a3bc2056..a11a5a5ca0 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -124,7 +124,7 @@ static int cache_url_handler(request_rec *r, int lookup) 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); } @@ -400,7 +400,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) 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; @@ -427,7 +427,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) * 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); } @@ -459,12 +459,12 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) * 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; @@ -475,7 +475,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) } /* 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; @@ -486,7 +486,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) } /* 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? @@ -539,7 +539,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) * 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)) @@ -658,7 +658,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) */ /* 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 @@ -674,7 +674,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) 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; @@ -743,15 +743,15 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) 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; @@ -773,7 +773,7 @@ static void * create_cache_config(apr_pool_t *p, server_rec *s) 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; @@ -781,11 +781,11 @@ static void * merge_cache_config(apr_pool_t *p, void *basev, void *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 */ diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h index 3b88f1845b..870b60b144 100644 --- a/modules/experimental/mod_cache.h +++ b/modules/experimental/mod_cache.h @@ -67,7 +67,6 @@ #include "apr_hooks.h" #include "apr.h" -#include "apr_compat.h" #include "apr_lib.h" #include "apr_strings.h" #include "apr_buckets.h" -- 2.40.0