On Thu, 22 Jun 2006 06:35:05 -0700
Paul Querna <[EMAIL PROTECTED]> wrote:
> Davi Arnaut wrote:
> > Don't cache requests with a expires date in the past; otherwise the cache
> > code
> > will _always_ try to cache the URL, leading to numerous rename() errors -
> > since
> > the URL is already cached.
> ...
> > Index: modules/cache/mod_cache.c
> > ===================================================================
> > --- modules/cache/mod_cache.c (revision 414393)
> > +++ modules/cache/mod_cache.c (working copy)
> > @@ -426,6 +426,9 @@
> > /* if a broken Expires header is present, don't cache it */
> > reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
> > }
> > + else if (exps != NULL && exp != APR_DATE_BAD && exp < apr_time_now()) {
> > + 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)
>
>
> Instead of calling apr_time_now(), shouldn't it re-use r->request_time
> here, saving a possibly expensive call?
>
> Otherwise, I think its a good fix.
>
Good catch, thanks!
--
Davi Arnaut
Index: mod_cache.c
===================================================================
--- mod_cache.c (revision 416367)
+++ mod_cache.c (working copy)
@@ -426,6 +426,9 @@
/* if a broken Expires header is present, don't cache it */
reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
}
+ else if (exps != NULL && exp != APR_DATE_BAD && exp < r->request_time) {
+ 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)