Lars Marowsky-Bree wrote:
>
> It seems virtually impossible to really remove an object from the cache.
Simple way to purge a object from the cache:
client -m PURGE http://...
You have to have a ACL list mentioning the PURGE method to enable it.
acl manager2 method PURGE
http_access deny manager2 !localhost
> This seems rather impractical for me, maybe cachemgr.cgi could
> provide a "purge URL" option?
Yes.
I have attached a small patch that adds "Remove" to cachemgr.cgi.
--- Henrik Nordström
--- squid-1.1.20/src/cachemgr.c.orig Wed Feb 25 22:48:42 1998
+++ squid-1.1.20/src/cachemgr.c Wed Feb 25 23:11:59 1998
@@ -234,9 +234,7 @@
STATS_NETDB,
SHUTDOWN,
REFRESH,
-#ifdef REMOVE_OBJECT
REMOVE,
-#endif
MAXOP
} op_t;
@@ -261,9 +259,7 @@
"stats/netdb",
"shutdown",
"refresh",
-#ifdef REMOVE_OBJECT
"remove",
-#endif
"unknown"
};
@@ -288,9 +284,7 @@
"Network Probe Database",
"Shutdown Cache",
"Refresh Object (URL required)",
-#ifdef REMOVE_OBJECT
"Remove Object (URL required)",
-#endif
"Unknown Operation"
};
@@ -376,9 +370,7 @@
print_option(op, STATS_R);
print_option(op, SHUTDOWN);
print_option(op, REFRESH);
-#ifdef REMOVE_OBJECT
print_option(op, REMOVE);
-#endif
printf("</SELECT><BR>\n");
printf("<HR>\n");
printf("<INPUT TYPE=\"submit\"> <INPUT TYPE=\"reset\">\n");
@@ -744,12 +736,9 @@
case REFRESH:
sprintf(msg, "GET %s HTTP/1.0\r\nPragma: no-cache\r\nAccept: */*\r\n\r\n", url);
break;
-#ifdef REMOVE_OBJECT
case REMOVE:
- printf("Remove not yet supported\n");
- exit(0);
- /* NOTREACHED */
-#endif
+ sprintf(msg, "PURGE %s HTTP/1.0\r\nAccept: */*\r\n\r\n", url);
+ break;
default:
case MAXOP:
printf("Unknown operation: %s\n", operation);
@@ -834,6 +823,7 @@
case STATS_NETDB:
case SHUTDOWN:
case REFRESH:
+ case REMOVE:
break;
case PARAM:
if (hasTables) {
@@ -879,10 +869,17 @@
else /* End of list */
p_state = 0;
else if ((indx == 0) && (n_loops == 1)) {
- if (op != REFRESH)
- printf("ERROR:%s\n", buf); /* Must be an error message, pass it on */
- else
+ switch (op) {
+ case REFRESH:
printf("Refreshed URL: %s\n", url);
+ break;
+ case REMOVE:
+ printf("Removed URL: %s\n", url);
+ break;
+ default:
+ printf("ERROR:%s\n", buf); /* Must be an error message, pass it on */
+ break;
+ }
} else
reserve[cpy_ind++] = buf[indx];
Received on Wed Feb 25 1998 - 14:38:59 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:59 MST