Here's a bit of code from squid-2 src/client_side.c:
if (http->entry) {
if (EBIT_TEST(http->entry->flags, ENTRY_SPECIAL)) {
httpHeaderDelById(hdr, HDR_DATE);
httpHeaderInsertTime(hdr, 0, HDR_DATE, squid_curtime);
} else if (http->entry->timestamp < 0) {
(void) 0;
} else if (http->conn->port->act_as_origin) {
HttpHeaderEntry *h = httpHeaderFindEntry(hdr, HDR_DATE);
if (h)
httpHeaderPutExt(hdr, "X-Origin-Date", strBuf(h->value));
httpHeaderDelById(hdr, HDR_DATE);
httpHeaderInsertTime(hdr, 0, HDR_DATE, squid_curtime);
h = httpHeaderFindEntry(hdr, HDR_EXPIRES);
if (h && http->entry->expires >= 0) {
httpHeaderPutExt(hdr, "X-Origin-Expires", strBuf(h->value));
httpHeaderDelById(hdr, HDR_EXPIRES);
httpHeaderInsertTime(hdr, 1, HDR_EXPIRES, squid_curtime + http->entry->expires - http->entry->timestamp);
} {
Why/where is the code assuming that offset 0 will be HDR_DATE and offset 1 will
be HDR_EXPIRES? The replacement code doesn't check to see whether anything is
at the position in the array that its inserting into..
Would it make more sense to modify httpHeaderDelById() to return the first offset
it found a header of that type at and then make httpHeaderInsertTime() use that?
Or perhaps replace that with a httpHeaderReplaceEntry() to replace an entry at
that position? httpHeaderInsertEntry() is only used by httpHeaderInsertTime();
httpHeaderInsertTime() is only ever called in the above snippet of code.
Thanks,
Adrian
-- - Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -Received on Mon Dec 10 2007 - 01:20:11 MST
This archive was generated by hypermail pre-2.1.9 : Mon Dec 31 2007 - 12:00:03 MST