diff -udrT httpd-2.2.10/modules/cache/mod_cache.c httpd-2.2.10-patched/modules/cache/mod_cache.c --- httpd-2.2.10/modules/cache/mod_cache.c 2008-05-28 00:23:12.000000000 +0800 +++ httpd-2.2.10-patched/modules/cache/mod_cache.c 2008-11-24 11:53:21.000000000 +0800 @@ -18,6 +18,9 @@ #include "mod_cache.h" + // Added by agentzh: + #define DONT_CARE_EXPIRE_STRING 1 + module AP_MODULE_DECLARE_DATA cache_module; APR_OPTIONAL_FN_TYPE(ap_cache_generate_key) *cache_generate_key; @@ -385,17 +388,25 @@ /* read expiry date; if a bad date, then leave it so the client can * read it */ - exps = apr_table_get(r->err_headers_out, "Expires"); - if (exps == NULL) { - exps = apr_table_get(r->headers_out, "Expires"); - } - if (exps != NULL) { - if (APR_DATE_BAD == (exp = apr_date_parse_http(exps))) { - exps = NULL; + + // Added by agentzh: + if (conf->override_expire_set) { + // Added by agentzh: + exps = DONT_CARE_EXPIRE_STRING; + exp = r->request_time + conf->override_expire; + } else { + exps = apr_table_get(r->err_headers_out, "Expires"); + if (exps == NULL) { + exps = apr_table_get(r->headers_out, "Expires"); + } + if (exps != NULL) { + if (APR_DATE_BAD == (exp = apr_date_parse_http(exps))) { + exps = NULL; + } + } + else { + exp = APR_DATE_BAD; } - } - else { - exp = APR_DATE_BAD; } /* read the last-modified date; if the date is bad, then delete it */ @@ -1136,6 +1147,19 @@ return NULL; } + // Added by agentzh: + static const char *set_cache_override_expire(cmd_parms *parms, void *dummy, + const char *arg) + { + cache_server_conf *conf; + + conf = + (cache_server_conf *)ap_get_module_config(parms->server->module_config, + &cache_module); + conf->override_expire = (apr_time_t) (atol(arg) * MSEC_ONE_SEC); + conf->override_expire_set = 1; + return NULL; + } static const char *set_cache_factor(cmd_parms *parms, void *dummy, const char *arg) { @@ -1221,6 +1245,10 @@ AP_INIT_TAKE1("CacheLastModifiedFactor", set_cache_factor, NULL, RSRC_CONF, "The factor used to estimate Expires date from " "LastModified date"), + // Added by agentzh: + AP_INIT_TAKE1("CacheOverrideExpire", set_cache_override_expire, NULL, RSRC_CONF, + "The expiration time overridding the one specified by the documents (if any)"), + {NULL} }; diff -udrT httpd-2.2.10/modules/cache/mod_cache.h httpd-2.2.10-patched/modules/cache/mod_cache.h --- httpd-2.2.10/modules/cache/mod_cache.h 2007-05-18 05:03:04.000000000 +0800 +++ httpd-2.2.10-patched/modules/cache/mod_cache.h 2008-11-24 11:53:22.000000000 +0800 @@ -153,6 +153,9 @@ /** ignore query-string when caching */ int ignorequerystring; int ignorequerystring_set; + // Added by agentzh: + int override_expire; + int override_expire_set; } cache_server_conf; /* cache info information */ diff -udrT httpd-2.2.10/modules/cache/mod_mem_cache.c httpd-2.2.10-patched/modules/cache/mod_mem_cache.c --- httpd-2.2.10/modules/cache/mod_mem_cache.c 2007-09-04 19:39:58.000000000 +0800 +++ httpd-2.2.10-patched/modules/cache/mod_mem_cache.c 2008-11-24 11:53:22.000000000 +0800 @@ -311,6 +311,10 @@ cache_object_t *obj, *tmp_obj; mem_cache_object_t *mobj; + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "Creating entity...", + key); + if (len == -1) { /* Caching a streaming response. Assume the response is * less than or equal to max_streaming_buffer_size. We will