Re: How to expire an object?

From: Peter Eisenhauer <pe@dont-contact.us>
Date: Wed, 16 Jul 1997 09:04:03 +0200 (MET DST)

>>>>> "EAP" == Eloy A Paris <eparis@ven.ra.rockwell.com> writes:

EAP> Hi,
EAP> is there a way to expire an object before it is normally expired
EAP> by Squid?

EAP> I have an object that is cached as type "text/x-server-parsed-html" and
EAP> this is wrong because when I telnet to port 80 of the real server
EAP> I get content type "text/html". I don't know how the wrong information
EAP> got cached (it could be because I upgraded Apache yesterday and somebody
EAP> accessed this URL while the server wasn't properly configured) but
EAP> I need to get rid of this faulty cache entry.

You can purge the object. Telnet to your Squid port and do:

PURGE url_of_object HTTP/1.0

Make sure Squid is configured to allow purging, for example in squid.conf

acl purge method PURGE
...
http_access allow xxx purge

xxx being an acl for hosts from which purges will be allowed.

Much more convenient is using cachemgr.cgi, I am including a patch which will
allow purging of object. (Just a quick hack, I made REMOVE as similar
REFRESH as needed ;-) )
The patch is from Squid 1.1.11 (since cachemgr.c is the same in 1.1.11 and
1.1.14 there should be no problems using 1.1.14).

Regards,
        Peter Eisenhauer

--- cachemgr.c.orig Fri Jun 13 19:00:08 1997
+++ cachemgr.c Tue Jun 17 14:54:02 1997
@@ -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"
 };
 
@@ -382,9 +376,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");
@@ -750,12 +742,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\nPragma: no-cache\r\nAccept: */*\r\n\r\n", url);
+ break;
     default:
     case MAXOP:
         printf("Unknown operation: %s\n", operation);
@@ -840,6 +829,7 @@
     case STATS_NETDB:
     case SHUTDOWN:
     case REFRESH:
+ case REMOVE:
         break;
     case PARAM:
         if (hasTables) {
@@ -885,10 +875,12 @@
                 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
+ if (op == REFRESH)
                     printf("Refreshed URL: %s\n", url);
+ else if (op == REMOVE)
+ printf("Removed URL: %s\n", url);
+ else
+ printf("ERROR:%s\n", buf); /* Must be an error message, pass it on */
             } else
                 reserve[cpy_ind++] = buf[indx];
 
@@ -929,6 +921,7 @@
                     printf("%s", reserve);
                     break;
                 case REFRESH:
+ case REMOVE:
                     /* throw object away */
                     break;
                 case PARAM:

 
Received on Wed Jul 16 1997 - 00:04:45 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:46 MST