clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) : http (cbdataReference(clientContext)), old_entry (NULL), old_sc(NULL), deleting(false)
{}
-/* create an error in the store awaiting the client side to read it. */
-/* This may be better placed in the clientStream logic, but it has not been
+/** Create an error in the store awaiting the client side to read it.
+ *
+ * This may be better placed in the clientStream logic, but it has not been
* relocated there yet
*/
void
return result;
}
-/*
- * filters out unwanted entries from original reply header
- * adds extra entries if we have more info than origin server
- * adds Squid specific entries
+/**
+ * Generate the reply headers sent to client.
+ *
+ * Filters out unwanted entries and hop-by-hop from original reply header
+ * then adds extra entries if we have more info than origin server
+ * then adds Squid specific entries
*/
void
clientReplyContext::buildReplyHeader()
// if (request->range)
// clientBuildRangeHeader(http, reply);
+
/*
* Add a estimated Age header on cache hits.
*/
* the objects age, so a Age: 0 header does not add any useful
* information to the reply in any case.
*/
-
+#if DEAD_CODE
+ // XXX: realy useless? or is there a bug now that this is detatched from the below if-sequence ?
+ // looks like this pre-if was supposed to be the browser workaround...
if (NULL == http->storeEntry())
(void) 0;
else if (http->storeEntry()->timestamp < 0)
(void) 0;
+#endif
if (EBIT_TEST(http->storeEntry()->flags, ENTRY_SPECIAL)) {
hdr->delById(HDR_DATE);
hdr->putStr(HDR_WARNING, tempbuf);
}
}
+ }
+ /* RFC 2616: Section 14.18
+ *
+ * Add a Date: header if missing.
+ * We have access to a clock therefore are required to amend any shortcoming in servers.
+ *
+ * NP: done after Age: to prevent ENTRY_SPECIAL double-handling this header.
+ */
+ if ( !hdr->has(HDR_DATE) ) {
+ if (http->storeEntry())
+ hdr->insertTime(HDR_DATE, http->storeEntry()->timestamp);
+ else
+ hdr->insertTime(HDR_DATE, squid_curtime);
}
/* Filter unproxyable authentication types */