From: rousskov <> Date: Wed, 3 Jun 1998 04:45:03 +0000 (+0000) Subject: - generate Age header for all responses. X-Git-Tag: SQUID_3_0_PRE1~3193 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69c46d249f995bd8c648cee7fe56e4c19704c46d;p=thirdparty%2Fsquid.git - generate Age header for all responses. --- diff --git a/src/client_side.cc b/src/client_side.cc index 4d74e277f1..68e6b80394 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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());