]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 1791: timestampsSet does not validate Date: if server sends very old date
authorBarry Dobyns <barry@dobyns.com>
Sun, 14 Aug 2011 03:48:26 +0000 (21:48 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 14 Aug 2011 03:48:26 +0000 (21:48 -0600)
src/store.cc

index 039903cd30fd6ddb982170d88c720c9d84331211..89d1d12ce9f0f08f318484563d96ee1fcbce0d8f 100644 (file)
@@ -1510,6 +1510,14 @@ StoreEntry::timestampsSet()
     if (served_date < 0 || served_date > squid_curtime)
         served_date = squid_curtime;
 
+    /* Bug 1791:
+     * If the returned Date: is more than 24 hours older than
+     * the squid_curtime, then one of us needs to use NTP to set our
+     * clock.  We'll pretend that our clock is right.
+     */
+    else if (served_date < (squid_curtime - 24 * 60 * 60) )
+        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