]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- generate Age header for all responses.
authorrousskov <>
Wed, 3 Jun 1998 04:45:03 +0000 (04:45 +0000)
committerrousskov <>
Wed, 3 Jun 1998 04:45:03 +0000 (04:45 +0000)
src/client_side.cc

index 4d74e277f19da35f2a3f7a750904c6a958f2e632..68e6b803944b89f4cc1bba6ce08a637c76c651f5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.324 1998/06/02 22:15:19 rousskov Exp $
+ * $Id: client_side.cc,v 1.325 1998/06/02 22:45:03 rousskov Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1155,6 +1155,17 @@ clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep)
     /* Handle Ranges */
     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, 1) ("clientBuildReplyHeader: entry's timestamp is invalid: %d ? %d\n",
+           http->entry->timestamp, squid_curtime);
+    }
     /* Append X-Cache */
     httpHeaderPutStrf(hdr, HDR_X_CACHE, "%s from %s",
        is_hit ? "HIT" : "MISS", getMyHostname());