httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject [patch 09/10] move open_entity
Date Mon, 24 Jul 2006 00:50:39 GMT
Move the open_entity call to cache_recall_entity_headers, adding a
new urlkey parameter.

Index: trunk/modules/cache/cache_storage.c
===================================================================
--- trunk.orig/modules/cache/cache_storage.c
+++ trunk/modules/cache/cache_storage.c
@@ -37,8 +37,16 @@ apr_status_t cache_store_entity_body(cac
 }
 
 apr_status_t cache_recall_entity_headers(const cache_provider *provider,
-                                         cache_handle_t *h, request_rec *r)
+                                         cache_handle_t *h, request_rec *r,
+                                         const char *urlkey)
 {
+    apr_status_t rv;
+
+    rv = provider->open_entity(h, r, urlkey);
+
+    if (rv != OK)
+        return rv;
+
     return provider->recall_headers(h, r);
 }
 
@@ -332,14 +340,9 @@ int cache_select(request_rec *r)
     list = cache->providers;
 
     while (list) {
-        switch ((rv = list->provider->open_entity(h, r, key))) {
-        case OK: {
-
-            if (cache_recall_entity_headers(list->provider, h, r) != APR_SUCCESS) {
-                /* TODO: Handle this error */
-                return DECLINED;
-            }
+        rv = cache_recall_entity_headers(list->provider, h, r, key);
 
+        if (rv == APR_SUCCESS) {
             if (cache_check_request(h, r, cache, list) != OK) {
                 return DECLINED;
             }
@@ -350,16 +353,11 @@ int cache_select(request_rec *r)
             cache->handle = h;
             return OK;
         }
-        case DECLINED: {
+        else {
             /* try again with next cache type */
             list = list->next;
             continue;
         }
-        default: {
-            /* oo-er! an error */
-            return rv;
-        }
-        }
     }
     return DECLINED;
 }
Index: trunk/modules/cache/mod_cache.h
===================================================================
--- trunk.orig/modules/cache/mod_cache.h
+++ trunk/modules/cache/mod_cache.h
@@ -308,7 +308,8 @@ const char* cache_create_key( request_re
 apr_status_t cache_store_entity_headers(cache_request_rec *cache, request_rec *r, cache_info
*info);
 apr_status_t cache_store_entity_body(cache_request_rec *cache, request_rec *r, apr_bucket_brigade
*bb);
 
-apr_status_t cache_recall_entity_headers(const cache_provider *provider, cache_handle_t *h,
request_rec *r);
+apr_status_t cache_recall_entity_headers(const cache_provider *provider, cache_handle_t *h,
request_rec *r,
+                                         const char *urlkey);
 apr_status_t cache_recall_entity_body(cache_request_rec *cache, apr_pool_t *pool, apr_bucket_brigade
*bb);
 
 /* hooks */

--

Mime
View raw message