Squid-2.2.STABLE4: Unexpected 304 replies There was a odd HTTP condition that could cause Squid to return "304 Not modified" on plain GET requests without If-Modified-Since. This would happen if the first attempt to retreive an object results in a 5XX error with a Last-Modified header. Squid then automatically tries to find another path for fetching the object, but accidently beleived the retry was a refresh of the error page... Index: squid/src/HttpRequest.c diff -u squid/src/HttpRequest.c:1.1.1.6.22.1 squid/src/HttpRequest.c:1.1.1.6.22.2 --- squid/src/HttpRequest.c:1.1.1.6.22.1 Tue Jul 13 00:37:15 1999 +++ squid/src/HttpRequest.c Wed Aug 4 22:33:21 1999 @@ -46,6 +46,7 @@ req->max_forwards = -1; req->client_addr = no_addr; req->my_addr = no_addr; + req->lastmod = -1; httpHeaderInit(&req->header, hoRequest); return req; } Index: squid/src/client_side.c diff -u squid/src/client_side.c:1.1.1.42.2.6 squid/src/client_side.c:1.1.1.42.2.7 --- squid/src/client_side.c:1.1.1.42.2.6 Sun Aug 1 17:27:54 1999 +++ squid/src/client_side.c Wed Aug 4 22:33:21 1999 @@ -310,7 +310,7 @@ /* delay_id is already set on original store client */ delaySetStoreClient(entry, http, delayClient(http->request)); #endif - entry->lastmod = http->old_entry->lastmod; + http->request->lastmod = http->old_entry->lastmod; debug(33, 5) ("clientProcessExpired: lastmod %d\n", (int) entry->lastmod); entry->refcount++; /* EXPIRED CASE */ http->entry = entry; Index: squid/src/http.c diff -u squid/src/http.c:1.1.1.35.2.4 squid/src/http.c:1.1.1.35.2.5 --- squid/src/http.c:1.1.1.35.2.4 Tue Jul 13 01:14:25 1999 +++ squid/src/http.c Wed Aug 4 22:33:23 1999 @@ -646,8 +646,8 @@ HttpHeaderPos pos = HttpHeaderInitPos; httpHeaderInit(hdr_out, hoRequest); /* append our IMS header */ - if (entry && entry->lastmod > -1 && request->method == METHOD_GET) - httpHeaderPutTime(hdr_out, HDR_IF_MODIFIED_SINCE, entry->lastmod); + if (request->lastmod > -1 && request->method == METHOD_GET) + httpHeaderPutTime(hdr_out, HDR_IF_MODIFIED_SINCE, request->lastmod); /* decide if we want to do Ranges ourselves * (and fetch the whole object now) @@ -894,6 +894,7 @@ xstrncpy(proxy_req->host, httpState->peer->host, SQUIDHOSTNAMELEN); proxy_req->port = httpState->peer->http_port; proxy_req->flags = orig_req->flags; + proxy_req->lastmod = orig_req->lastmod; httpState->request = requestLink(proxy_req); httpState->orig_request = requestLink(orig_req); proxy_req->flags.proxying = 1; Index: squid/src/store.c diff -u squid/src/store.c:1.1.1.39.2.4 squid/src/store.c:1.1.1.39.2.5 --- squid/src/store.c:1.1.1.39.2.4 Tue Jul 27 19:34:37 1999 +++ squid/src/store.c Wed Aug 4 22:33:23 1999 @@ -1249,4 +1249,5 @@ mem->inmem_hi = mem->inmem_lo = 0; httpReplyDestroy(mem->reply); mem->reply = httpReplyCreate(); + e->expires = e->lastmod = e->timestamp = -1; } Index: squid/src/structs.h diff -u squid/src/structs.h:1.1.1.39.2.12 squid/src/structs.h:1.1.1.39.2.13 --- squid/src/structs.h:1.1.1.39.2.12 Mon Aug 2 22:27:14 1999 +++ squid/src/structs.h Wed Aug 4 22:33:24 1999 @@ -1326,6 +1326,7 @@ HierarchyLogEntry hier; err_type err_type; char *peer_login; /* Configured peer login:password */ + time_t lastmod; /* Used on refreshes */ }; struct _cachemgr_passwd {