]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- do not supply Age header if store entry does not have a valid timestamp
authorrousskov <>
Thu, 16 Jul 1998 06:29:53 +0000 (06:29 +0000)
committerrousskov <>
Thu, 16 Jul 1998 06:29:53 +0000 (06:29 +0000)
src/client_side.cc

index 29c618bc1ab09ad4466568c0f9a9635d28aa8c96..845f6021bd938dd79a276c01ab010a70be22064b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.352 1998/07/16 00:18:52 rousskov Exp $
+ * $Id: client_side.cc,v 1.353 1998/07/16 00:29:53 rousskov Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1061,12 +1061,15 @@ 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 */
-    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);
+    if (http->entry->timestamp > 0) {
+       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());