--On Sunday, August 1, 2004 11:25 AM -0400 Bill Stoddard <[EMAIL PROTECTED]> wrote:

Too many changes in one patch. Break this up into multiple consumable in 15
minute patches and I'll review them.

* modules/experimental/mod_cache.c: Delay no-store check until saving. (It's a corner case with little benefit in the mainline.)

Index: modules/experimental/mod_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v
retrieving revision 1.83
diff -u -r1.83 mod_cache.c
--- modules/experimental/mod_cache.c    25 May 2004 18:01:02 -0000      1.83
+++ modules/experimental/mod_cache.c    1 Aug 2004 08:24:52 -0000
@@ -100,7 +95,6 @@
     */

    /* find certain cache controlling headers */
-    cc_in = apr_table_get(r->headers_in, "Cache-Control");
    pragma = apr_table_get(r->headers_in, "Pragma");
    auth = apr_table_get(r->headers_in, "Authorization");

@@ -123,13 +117,14 @@
"%s, but we know better and are ignoring it", url);
}
else {
- if (ap_cache_liststr(NULL, cc_in, "no-store", NULL) ||
- ap_cache_liststr(NULL, pragma, "no-cache", NULL) || (auth != NULL)) {
+ if (ap_cache_liststr(NULL, pragma, "no-cache", NULL) ||
+ auth != NULL) {
/* delete the previously cached file */
cache_remove_url(r, cache->types, url);


            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-                         "cache: no-store forbids caching of %s", url);
+                         "cache: no-cache or authorization forbids caching "
+                         "of %s", url);
            return DECLINED;
        }
    }
@@ -396,7 +316,7 @@
    cache_request_rec *cache;
    cache_server_conf *conf;
    char *url = r->unparsed_uri;
-    const char *cc_out, *cl;
+    const char *cc_in, *cc_out, *cl;
    const char *exps, *lastmods, *dates, *etag;
    apr_time_t exp, date, lastmod, now;
    apr_off_t size;
@@ -405,17 +325,19 @@
    apr_pool_t *p;

    /* check first whether running this filter has any point or not */
-    if(r->no_cache) {
+    /* If the user has Cache-Control: no-store from RFC 2616, don't store! */
+    cc_in = apr_table_get(r->headers_in, "Cache-Control");
+    if (r->no_cache || ap_cache_liststr(NULL, cc_in, "no-store", NULL)) {
        ap_remove_output_filter(f);
        return ap_pass_brigade(f->next, in);
    }

- 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);
+ cache = (cache_request_rec *) ap_get_module_config(r->request_config,
+ &cache_module);
if (!cache) {
+ /* user likely configured CACHE_SAVE manually; they should really use
+ * mod_cache configuration to do that */
cache = apr_pcalloc(r->pool, sizeof(cache_request_rec));
ap_set_module_config(r->request_config, &cache_module, cache);
}




Reply via email to