httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1023392 - /httpd/httpd/trunk/modules/cache/cache_storage.c
Date Sun, 17 Oct 2010 00:01:45 GMT
Author: minfrin
Date: Sun Oct 17 00:01:45 2010
New Revision: 1023392

URL: http://svn.apache.org/viewvc?rev=1023392&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/modules/cache/cache_storage.c

Modified: httpd/httpd/trunk/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_storage.c?rev=1023392&r1=1023391&r2=1023392&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_storage.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_storage.c Sun Oct 17 00:01:45 2010
@@ -229,11 +229,12 @@ int cache_select(cache_request_rec *cach
         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 *cach
                     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 *cach
                                       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 *cach
                         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. */



Mime
View raw message