Squid-2.2.STABLE2: Don't give ICP HIT on non-200 objects There is a common false hit condition with objects with a HTTP status other than 200 (HTTP_OK). These will cause false hits if a client sends a If-Modified-Since request. This patch makes a minor change to the on-disk store, and may or may not be fully compatible with future Squid releases. Don't use this patch unless you are prepared to clean your cache on next upgrade. Index: squid/src/icp_v2.c diff -u squid/src/icp_v2.c:1.1.1.23 squid/src/icp_v2.c:1.1.1.23.8.1 --- squid/src/icp_v2.c:1.1.1.23 Sun Feb 14 23:30:01 1999 +++ squid/src/icp_v2.c Tue May 11 04:43:31 1999 @@ -173,6 +173,8 @@ return 0; if (Config.onoff.icp_hit_stale) return 1; + if (EBIT_TEST(e->flags, ENTRY_NOT_HTTP_OK)) + return 0; if (refreshCheckICP(e, request)) return 0; return 1; Index: squid/src/store_swapout.c diff -u squid/src/store_swapout.c:1.1.1.14 squid/src/store_swapout.c:1.1.1.14.8.1 --- squid/src/store_swapout.c:1.1.1.14 Sun Feb 14 23:30:10 1999 +++ squid/src/store_swapout.c Tue May 11 04:43:31 1999 @@ -58,6 +58,9 @@ ctrlp->swapfilename = xstrdup(storeSwapFullPath(e->swap_file_number, NULL)); ctrlp->e = e; ctrlp->oldswapstatus = e->swap_status; + if (e->mem_obj->reply && e->mem_obj->reply->sline.status != HTTP_OK) { + EBIT_SET(e->flags, ENTRY_NOT_HTTP_OK); + } e->swap_status = SWAPOUT_OPENING; e->mem_obj->swapout.ctrl = ctrlp; store_open_disk_fd++; Index: squid/src/enums.h diff -u squid/src/enums.h:1.1.1.31.8.1 squid/src/enums.h:1.1.1.31.8.2 --- squid/src/enums.h:1.1.1.31.8.1 Wed May 5 11:33:50 1999 +++ squid/src/enums.h Tue May 11 04:43:59 1999 @@ -449,7 +449,8 @@ ENTRY_NEGCACHED, ENTRY_VALIDATED, ENTRY_BAD_LENGTH, - ENTRY_ABORTED + ENTRY_ABORTED, + ENTRY_NOT_HTTP_OK }; typedef enum {