]> granicus.if.org Git - apache/commitdiff
Fix for PR 14556. The expiry calculations in mod_cache were
authorPaul J. Reder <rederpj@apache.org>
Thu, 21 Nov 2002 21:52:47 +0000 (21:52 +0000)
committerPaul J. Reder <rederpj@apache.org>
Thu, 21 Nov 2002 21:52:47 +0000 (21:52 +0000)
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

CHANGES
modules/experimental/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 1805dca7a90675212480f8fcbf6a30dab6e0537f..3f1e9e06aa21ac35c39e91a544e2cb1e7ee2e449 100644 (file)
--- 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 <Juan.Rivera@citrix.com>]
index 8906b260f9996abc2aec94366915f3f6ecf4bd0a..5a0de969ba02e58d1f7fab3fac2c4bd925689c1b 100644 (file)
@@ -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;