From: Graham Leggett Date: Thu, 12 Oct 2006 23:03:17 +0000 (+0000) Subject: mod_cache: Don't cache requests with a expires date in the past; X-Git-Tag: 2.2.4~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8320100463ad2224e0407a8bb7ffc0913d41f532;p=thirdparty%2Fapache%2Fhttpd.git mod_cache: Don't cache requests with a expires date in the past; otherwise mod_cache will always try to cache the URL. This bug might lead to numerous rename() errors on win32 if the URL was previously cached. +1: minfrin, rpluem, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@463496 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 7d02e1b0bb5..d0501d550f8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.4 + *) mod_cache: Don't cache requests with a expires date in the past; + otherwise mod_cache will always try to cache the URL. This bug + might lead to numerous rename() errors on win32 if the URL was + previously cached. [Davi Arnaut ] + *) core: Deal with the widespread use of apr_status_t return values as HTTP status codes, as documented in PR#31759 (a bug shared by the default handler, mod_cgi, mod_cgid, mod_proxy, and probably diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index e492fea5b88..fe93f7da848 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -426,6 +426,11 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) /* if a broken Expires header is present, don't cache it */ reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL); } + else if (exp != APR_DATE_BAD && exp < r->request_time) + { + /* if a Expires header is in the past, don't cache it */ + reason = "Expires header already expired, not cacheable"; + } else if (r->args && exps == NULL) { /* if query string present but no expiration time, don't cache it * (RFC 2616/13.9)