Hi,

Currently CacheIgnoreCacheControl On only ignores Cache-Control: no-cache
and Pragma: no-cache.  I'd like to add ignoring Cache-Control: max-age=...
and Cache-Control: min-fresh=... as well.

This would give the admin more control, and would also make the directive
slightly more intuitive IMO.  This because different browsers do different
things.  One will send a Cache-Control: no-cache on a refresh, and one will
send a Cache-Control: max-age=...  It would be nice if the effect would
be the same for both.

Thoughts?

Sander
Log:
Make CacheIgnoreCacheControl do what it implies, at least when it comes to
freshness checks.

* modules/cache/cache_util.c

  (ap_cache_check_freshness): Ignore CacheControl: max-age and min-fresh
   as well if CacheIgnoreCacheControl is set.


Index: modules/cache/cache_util.c
===================================================================
--- modules/cache/cache_util.c  (revision 156480)
+++ modules/cache/cache_util.c  (working copy)
@@ -122,6 +122,9 @@
     char *val;
     apr_time_t age_c = 0;
     cache_info *info = &(h->cache_obj->info);
+    cache_server_conf *conf =
+      (cache_server_conf *)ap_get_module_config(r->server->module_config,
+                                                &cache_module);
 
     /*
      * We now want to check if our cached data is still fresh. This depends
@@ -162,9 +165,6 @@
 
     if (ap_cache_liststr(NULL, pragma, "no-cache", NULL)
         || ap_cache_liststr(NULL, cc_req, "no-cache", NULL)) {
-        cache_server_conf *conf =
-          (cache_server_conf *)ap_get_module_config(r->server->module_config,
-                                                    &cache_module);
 
         if (!conf->ignorecachecontrol) {
            /* Treat as stale, causing revalidation */
@@ -172,7 +172,7 @@
        }
 
         ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
-                     "Incoming request may be asking for a uncached version of 
"
+                     "Incoming request is asking for a uncached version of "
                      "%s, but we know better and are ignoring it",
                      r->unparsed_uri);
     }
@@ -197,7 +197,8 @@
     }
 
     /* extract max-age from request */
-    if (cc_req && ap_cache_liststr(r->pool, cc_req, "max-age", &val)) {
+    if (!conf->ignorecachecontrol
+        && cc_req && ap_cache_liststr(r->pool, cc_req, "max-age", &val)) {
         maxage_req = apr_atoi64(val);
     }
     else {
@@ -234,7 +235,8 @@
     }
 
     /* extract min-fresh */
-    if (cc_req && ap_cache_liststr(r->pool, cc_req, "min-fresh", &val)) {
+    if (!conf->ignorecachecontrol
+        && cc_req && ap_cache_liststr(r->pool, cc_req, "min-fresh", &val)) {
         minfresh = apr_atoi64(val);
     }
     else {

Reply via email to