]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid making 'served_date' negative in storeTimestampsSet().
authorwessels <>
Fri, 23 Feb 2001 03:53:15 +0000 (03:53 +0000)
committerwessels <>
Fri, 23 Feb 2001 03:53:15 +0000 (03:53 +0000)
src/store.cc

index f929e7fe4031ddf2989521dae3f73da08132203e..9ba6228fa93bf8f3a8afb521d20fc95435fa9502 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.536 2001/01/12 00:37:21 wessels Exp $
+ * $Id: store.cc,v 1.537 2001/02/22 20:53:15 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1027,11 +1027,14 @@ storeTimestampsSet(StoreEntry * entry)
     if (served_date < 0 || served_date > squid_curtime)
        served_date = squid_curtime;
     /*
-     * Compensate with Age header if origin server clock is ahead of us
-     * and there is a cache in between us and the origin server
+     * Compensate with Age header if origin server clock is ahead
+     * of us and there is a cache in between us and the origin
+     * server.  But DONT compensate if the age value is larger than
+     * squid_curtime because it results in a negative served_date.
      */
     if (age > squid_curtime - served_date)
-       served_date = squid_curtime - age;
+       if (squid_curtime < age)
+           served_date = squid_curtime - age;
     entry->expires = reply->expires;
     entry->lastmod = reply->last_modified;
     entry->timestamp = served_date;