summaryrefslogtreecommitdiff
path: root/modules/cache/cache_storage.c
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2010-10-17 00:01:45 +0000
committerGraham Leggett <minfrin@apache.org>2010-10-17 00:01:45 +0000
commitfc7955190fec8bc130daa36af792a9e0626951a9 (patch)
tree20ba07ce4b290325b7b552226eb036b350990108 /modules/cache/cache_storage.c
parent44584f6a5a91799dc2e497d36d647b2d6a60683d (diff)
downloadhttpd-fc7955190fec8bc130daa36af792a9e0626951a9.tar.gz
Fix the error cases in the cache_select() loop. On error we must loop around
to the next provider, not return DECLINED too early, except for the revalidate case, where returning DECLINED is correct behaviour. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023392 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache/cache_storage.c')
-rw-r--r--modules/cache/cache_storage.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c
index fc5cc465c6..32105836ab 100644
--- a/modules/cache/cache_storage.c
+++ b/modules/cache/cache_storage.c
@@ -229,11 +229,12 @@ int cache_select(cache_request_rec *cache, request_rec *r)
switch ((rv = list->provider->open_entity(h, r, cache->key))) {
case OK: {
char *vary = NULL;
- int fresh;
+ int fresh, mismatch = 0;
if (list->provider->recall_headers(h, r) != APR_SUCCESS) {
- /* TODO: Handle this error */
- return DECLINED;
+ /* try again with next cache type */
+ list = list->next;
+ continue;
}
/*
@@ -284,10 +285,17 @@ int cache_select(cache_request_rec *cache, request_rec *r)
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS,
r->server,
"cache_select_url(): Vary header mismatch.");
- return DECLINED;
+ mismatch = 1;
}
}
+ /* no vary match, try next provider */
+ if (mismatch) {
+ /* try again with next cache type */
+ list = list->next;
+ continue;
+ }
+
cache->provider = list->provider;
cache->provider_name = list->provider_name;
@@ -337,6 +345,9 @@ int cache_select(cache_request_rec *cache, request_rec *r)
lastmod);
}
cache->stale_handle = h;
+
+ /* ready to revalidate, pretend we were never here */
+ return DECLINED;
}
else {
int irv;
@@ -351,9 +362,12 @@ int cache_select(cache_request_rec *cache, request_rec *r)
ap_log_error(APLOG_MARK, APLOG_DEBUG, irv, r->server,
"cache: attempt to remove url from cache unsuccessful.");
}
+
+ /* try again with next cache type */
+ list = list->next;
+ continue;
}
- return DECLINED;
}
/* Okay, this response looks okay. Merge in our stuff and go. */