From: Paul J. Reder Date: Thu, 21 Nov 2002 21:52:47 +0000 (+0000) Subject: Fix for PR 14556. The expiry calculations in mod_cache were X-Git-Tag: 2.0.45~606 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ecb3aaaa8353f7bccc08c40cc9fa684f452a1a60;p=apache Fix for PR 14556. The expiry calculations in mod_cache were trying to perform "now + ((date - lastmod) * factor)" where date == lastmod resulting in "now + 0". The code now follows the else path (using the default expiration) if date is equal to lastmod. [rx@armstrike.com (Sergey), Paul J. Reder] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97589 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 1805dca7a9..3f1e9e06aa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,11 @@ Changes with Apache 2.0.44 + *) Fix for PR 14556. The expiry calculations in mod_cache were + trying to perform "now + ((date - lastmod) * factor)" where + date == lastmod resulting in "now + 0". The code now follows + the else path (using the default expiration) if date is + equal to lastmod. [rx@armstrike.com (Sergey), Paul J. Reder] + *) Use AP_DECLARE in the debug versions of ap_strXXX in case the default calling convention is not the same as the one used by AP_DECLARE. [Juan Rivera ] diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index 8906b260f9..5a0de969ba 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -850,7 +850,11 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) * expire date = now + defaultexpire */ if (exp == APR_DATE_BAD) { - if (lastmod != APR_DATE_BAD) { + /* if lastmod == date then you get 0*conf->factor which results in + * an expiration time of now. This causes some problems with + * freshness calculations, so we choose the else path... + */ + if ((lastmod != APR_DATE_BAD) && (lastmod < date)) { apr_time_t x = (apr_time_t) ((date - lastmod) * conf->factor); if (x > conf->maxex) { x = conf->maxex;