]> granicus.if.org Git - apache/commitdiff
A few more lazy initializations. No function change (I hope :-)
authorBill Stoddard <stoddard@apache.org>
Wed, 11 Dec 2002 22:31:28 +0000 (22:31 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 11 Dec 2002 22:31:28 +0000 (22:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97880 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_cache.c

index a10643d5020bbe10fa7b5d9fc337aef5e789f33d..fb0609f3eeda0d730bc2215e5361200ad33f0eaa 100644 (file)
@@ -418,23 +418,16 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
 {
     int rv;
     request_rec *r = f->r;
+    cache_request_rec *cache;
+    cache_server_conf *conf;
     char *url = r->unparsed_uri;
     const char *cc_out;
     const char *exps, *lastmods, *dates, *etag;
     apr_time_t exp, date, lastmod, now;
     apr_off_t size;
     cache_info *info;
-    void *sconf = r->server->module_config;
-    cache_server_conf *conf =
-        (cache_server_conf *) ap_get_module_config(sconf, &cache_module);
-    void *scache = r->request_config;
-    cache_request_rec *cache =
-        (cache_request_rec *) ap_get_module_config(scache, &cache_module);
-    apr_bucket *split_point = NULL;
 
-
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->r->server,
-                 "cache: running CACHE_IN filter");
+    apr_bucket *split_point = NULL;
 
     /* check first whether running this filter has any point or not */
     if(r->no_cache) {
@@ -442,10 +435,11 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
         return ap_pass_brigade(f->next, in);
     }
 
-    /* make space for the per request config 
-     * We hit this code path when CACHE_IN has been installed by someone
-     * other than the cache handler
-     */
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                 "cache: running CACHE_IN filter");
+
+    /* Setup cache_request_rec */
+    cache = (cache_request_rec *) ap_get_module_config(r->request_config, &cache_module);
     if (!cache) {
         cache = apr_pcalloc(r->pool, sizeof(cache_request_rec));
         ap_set_module_config(r->request_config, &cache_module, cache);
@@ -516,6 +510,7 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
             lastmod = APR_DATE_BAD;
         }
 
+        conf = (cache_server_conf *) ap_get_module_config(r->server->module_config, &cache_module);
         /* read the etag and cache-control from the entity */
         etag = apr_table_get(r->headers_out, "Etag");
         cc_out = apr_table_get(r->headers_out, "Cache-Control");