]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- often entry->timestamp is greater than squid_curtime; perhaps due to clock
authorrousskov <>
Wed, 3 Jun 1998 05:29:03 +0000 (05:29 +0000)
committerrousskov <>
Wed, 3 Jun 1998 05:29:03 +0000 (05:29 +0000)
  de-synchronization with origin server. Set age to 0 in such cases because
  "timestamp > squid_curtime" probably means that we just got or revalidated
  the object anyway.

src/client_side.cc

index b8408f6a018e00cf0abfdbead5ac3f73e133dc90..a2a0078a3f3dd9776fdf692e44901bc6fdb3b927 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.326 1998/06/02 23:17:46 rousskov Exp $
+ * $Id: client_side.cc,v 1.327 1998/06/02 23:29:03 rousskov Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1156,16 +1156,12 @@ clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep)
     if (http->request->range)
        clientBuildRangeHeader(http, rep);
     /* Add Age header, not that our header must replace Age headers from other caches if any */
-    if (http->entry->timestamp <= squid_curtime) {
-       httpHeaderDelById(hdr, HDR_AGE);
-       /* we do not follow HTTP/1.1 precisely here becuase we rely on Date
-        * header when computing entry->timestamp; we should be using _request_ time
-        * if Date header is not available */
-       httpHeaderPutInt(hdr, HDR_AGE, squid_curtime - http->entry->timestamp);
-    } else {
-       debug(33, 5) ("clientBuildReplyHeader: entry's timestamp is invalid: %d ? %d\n",
-           http->entry->timestamp, squid_curtime);
-    }
+    httpHeaderDelById(hdr, HDR_AGE);
+    /* we do not follow HTTP/1.1 precisely here becuase we rely on Date
+     * header when computing entry->timestamp; we should be using _request_ time
+     * if Date header is not available or if it is out of sync */
+    httpHeaderPutInt(hdr, HDR_AGE,
+       http->entry->timestamp <= squid_curtime ? squid_curtime - http->entry->timestamp : 0);
     /* Append X-Cache */
     httpHeaderPutStrf(hdr, HDR_X_CACHE, "%s from %s",
        is_hit ? "HIT" : "MISS", getMyHostname());