Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 63539 invoked from network); 8 Mar 2005 02:58:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Mar 2005 02:58:05 -0000 Received: (qmail 65736 invoked by uid 500); 8 Mar 2005 02:58:03 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 65714 invoked by uid 500); 8 Mar 2005 02:58:02 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 65701 invoked by uid 99); 8 Mar 2005 02:58:02 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from striker.nl (HELO mail.striker.nl) (213.84.19.217) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 07 Mar 2005 18:58:01 -0800 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.striker.nl (Postfix) with ESMTP id 8AF021CC537 for ; Tue, 8 Mar 2005 03:57:53 +0100 (CET) Received: from mail.striker.nl ([127.0.0.1]) by localhost (argh.striker.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30979-10 for ; Tue, 8 Mar 2005 03:57:52 +0100 (CET) Received: from [192.168.0.102] (Grmbl.striker.nl [192.168.0.102]) by mail.striker.nl (Postfix) with ESMTP id DCFA71CC52C for ; Tue, 8 Mar 2005 03:57:52 +0100 (CET) Message-ID: <422D14B3.2040900@apache.org> Date: Tue, 08 Mar 2005 03:57:55 +0100 From: Sander Striker User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@httpd.apache.org Subject: [PATCH] mod_cache, expand impact of CacheIgnoreCacheControl Content-Type: multipart/mixed; boundary="------------000008040103020308090500" X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at striker.nl X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. --------------000008040103020308090500 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------000008040103020308090500 Content-Type: text/plain; name="ignorecachecontrol.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ignorecachecontrol.patch" 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 { --------------000008040103020308090500--