--On Tuesday, September 7, 2004 2:48 PM +1000 Ian Holsman <[EMAIL PROTECTED]> wrote:
here is the patch I initially did, but I like Bill's idea about adding a default expiry as well... which could be done in a different way.
Not really, but I'd like to see a patch posted to this list first before committing it. There's a couple ways I could see implementing this, but not sure which way you are intending to do this. -- justin
ianh:/src/httpd-2.0/modules/experimental ianh$ cvs diff -u Index: mod_cache.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v retrieving revision 1.64.2.14 diff -u -u -r1.64.2.14 mod_cache.c --- mod_cache.c 26 Aug 2004 16:59:44 -0000 1.64.2.14 +++ mod_cache.c 8 Sep 2004 06:13:12 -0000 @@ -445,7 +445,7 @@ /* if a broken Expires header is present, don't cache it */ reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL); } - else if (r->args && exps == NULL) { + else if (r->args && exps == NULL && (conf->no_expires == 0)) { /* if query string present but no expiration time, don't cache it * (RFC 2616/13.9) */ @@ -747,6 +747,9 @@ ps->complete_set = 0; ps->no_last_mod_ignore_set = 0; ps->no_last_mod_ignore = 0; + + ps->no_expires_set = 0; + ps->no_expires = 0; ps->ignorecachecontrol = 0; ps->ignorecachecontrol_set = 0 ; return ps; @@ -781,6 +784,12 @@ (overrides->no_last_mod_ignore_set == 0) ? base->no_last_mod_ignore : overrides->no_last_mod_ignore; + + ps->no_expires= + (overrides->no_expires_set == 0) + ? base->no_expires + : overrides->no_expires; + ps->ignorecachecontrol = (overrides->ignorecachecontrol_set == 0) ? base->ignorecachecontrol @@ -800,7 +809,19 @@ return NULL;
}
+static const char *set_cache_ignore_no_expires(cmd_parms *parms, void *dummy,
+ int flag)
+{
+ cache_server_conf *conf;
+
+ conf =
+ (cache_server_conf *)ap_get_module_config(parms->server->module_config,
+ &cache_module);
+ conf->no_expires = flag;
+ conf->no_expires_set = 1;
+ return NULL;
+}
static const char *set_cache_ignore_cachecontrol(cmd_parms *parms,
void *dummy, int flag)
{
@@ -942,6 +963,10 @@
AP_INIT_FLAG("CacheIgnoreNoLastMod", set_cache_ignore_no_last_mod, NULL,
RSRC_CONF,
"Ignore Responses where there is no Last Modified Header"),
+ AP_INIT_FLAG("CacheIgnoreNoExpires", set_cache_ignore_no_expires, NULL,
+ RSRC_CONF,
+ "Ignore Check on which forces expires to be present"),
+
AP_INIT_FLAG("CacheIgnoreCacheControl", set_cache_ignore_cachecontrol,
NULL,
RSRC_CONF,
Index: mod_cache.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.h,v
retrieving revision 1.36.2.8
diff -u -u -r1.36.2.8 mod_cache.h
--- mod_cache.h 26 Aug 2004 18:35:13 -0000 1.36.2.8
+++ mod_cache.h 8 Sep 2004 06:13:12 -0000
@@ -130,6 +130,10 @@
/** ignore the last-modified header when deciding to cache this request */
int no_last_mod_ignore_set;
int no_last_mod_ignore;
+
+ /** disable check of expires header */
+ int no_expires_set;
+ int no_expires;
/** ignore client's requests for uncached responses */
int ignorecachecontrol;
int ignorecachecontrol_set;