I've been puzzling over how to do this for many weeks, and it finally
struck me this morning.
Some background - if you are using the RETRY_PATCH functionality,
which is on by default in 1.1.22, then the only way an entry can leave
the IP cache is for its timeout to expire. This is so that addresses
which stop responding can be marked as BAD, and retried later without
another DNS lookup. However, this means that if a host's IP address
changes, you have to wait until the ipcache entry expires
(positive_dns_ttl, defaults to 6 hours) or restart Squid to clear out
that entry.
This patch allows you to simply issue a "PURGE" request using any URL
for that host, and in addition to purging the URL, it will expire the
ipcache entry. Regardless of whether the URL is found in the cache or
not, the hostname in the URL will be removed from the IP cache, and
logged in cache.log:
% client -m PURGE http://ad.doubleclick.net/
HTTP/1.0 404 Not Found
Date: Mon, 29 Jun 1998 19:27:16 GMT
Server: Squid/1..1.22
But in cache.log:
1998/06/29 15:27:16| purge request: invalidating "ad.doubleclick.net" in IP cache
This patch is also available at
<ftp://ftp.comshare.com/pub/squid/ipcache_purge.patch>
-----------------------------------
--- src/client_side.c.orig Mon Jun 29 15:10:50 1998
+++ src/client_side.c Mon Jun 29 15:16:51 1998
@@ -664,7 +664,24 @@
LOCAL_ARRAY(char, msg, 8192);
LOCAL_ARRAY(char, line, 256);
StoreEntry *entry;
+#ifdef RETRY_PATCH
+ request_t *urlinfo;
+#endif /* RETRY_PATCH */
debug(0, 0, "Config.Options.enable_purge = %d\n", Config.Options.enable_purge);
+#ifdef RETRY_PATCH
+ if ((urlinfo = urlParse(METHOD_PURGE, icpState->url)) != NULL) {
+ debug(33, 1, "purge request: invalidating \"%s\" in IP cache\n",
+ urlinfo->host);
+ if (urlinfo->host != NULL)
+ ipcacheInvalidate(urlinfo->host);
+ else
+ debug(33, 4, "urlParse(METHOD_PURGE, \"%s\")->host NULL\n",
+ icpState->url);
+ } else {
+ debug(33, 4, "urlParse(METHOD_PURGE, \"%s\") returned NULL\n",
+ icpState->url);
+ }
+#endif /* RETRY_PATCH */
if (!Config.Options.enable_purge) {
buf = access_denied_msg(icpState->http_code = 401,
icpState->method,
-----------------------------------
-- "[It will] be very hard to increase browser share on the merits of [Internet Explorer] alone. It will be more important to leverage the OS asset to make people use IE instead of Navigator." -- Christian Wildfeuer, a Microsoft ManagerReceived on Mon Jun 29 1998 - 12:46:01 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:40:53 MST