From fc7955190fec8bc130daa36af792a9e0626951a9 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sun, 17 Oct 2010 00:01:45 +0000 Subject: [PATCH] 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 --- modules/cache/cache_storage.c | 24 +++++++++++++++++++----- 1 file 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. */ -- 2.50.1