]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
support for PURGE method
authorwessels <>
Tue, 4 Feb 1997 06:03:04 +0000 (06:03 +0000)
committerwessels <>
Tue, 4 Feb 1997 06:03:04 +0000 (06:03 +0000)
src/acl.cc
src/client_side.cc
src/url.cc

index 8b49c9bc5332267b14f6138825331b7431cdf924..4c978bbf8f4ba2be0af17076eb9270682b60e97b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.80 1997/02/03 22:05:11 wessels Exp $
+ * $Id: acl.cc,v 1.81 1997/02/03 23:03:04 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -196,6 +196,8 @@ aclParseMethodList(void *curlist)
     while ((t = strtokFile())) {
        q = xcalloc(1, sizeof(intlist));
        q->i = (int) urlParseMethod(t);
+       if (q->i == METHOD_PURGE)
+               Config.Options.enable_purge = 1;
        *(Tail) = q;
        Tail = &q->next;
     }
@@ -351,10 +353,6 @@ aclSplayIpCompare(struct in_addr addr, struct _acl_ip_data *data)
        else
            rc = 0;
     }
-    debug(28,0,"aclSplayIpCompare:   key=%s\n", inet_ntoa(addr));
-    debug(28,0,"aclSplayIpCompare: addr1=%s\n", inet_ntoa(data->addr1));
-    debug(28,0,"aclSplayIpCompare: addr2=%s\n", inet_ntoa(data->addr2));
-    debug(28,0,"aclSplayIpCompare: returning %d\n", rc);
     return rc;
 }
 
index 9f805b39b8721a9e52e95380308113cc5e82083a..40608e00d07930e2e5cf854fdae31436de7c363e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.85 1997/01/24 20:39:49 wessels Exp $
+ * $Id: client_side.cc,v 1.86 1997/02/03 23:03:05 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -608,3 +608,43 @@ clientConstructTraceEcho(icpStateData * icpState)
     icpState->http_code = 200;
     return buf;
 }
+
+void
+clientPurgeRequest(icpStateData * icpState)
+{
+    char *buf;
+    int fd = icpState->fd;
+    LOCAL_ARRAY(char, msg, 8192);
+    LOCAL_ARRAY(char, line, 256);
+    StoreEntry *entry;
+debug(0,0,"Config.Options.enable_purge = %d\n", Config.Options.enable_purge);
+    if (!Config.Options.enable_purge) {
+       buf = access_denied_msg(icpState->http_code = 401,
+           icpState->method,
+           icpState->url,
+           fd_table[fd].ipaddr);
+       icpSendERROR(fd, LOG_TCP_DENIED, buf, icpState, icpState->http_code);
+       return;
+    }
+    icpState->log_type = TCP_MISS;
+    if ((entry = storeGet(icpState->url)) == NULL) {
+       sprintf(msg, "HTTP/1.0 404 Not Found\r\n");
+       icpState->http_code = 404;
+    } else {
+       storeRelease(entry);
+       sprintf(msg, "HTTP/1.0 200 OK\r\n");
+       icpState->http_code = 200;
+    }
+    sprintf(line, "Date: %s\r\n", mkrfc1123(squid_curtime));
+    strcat(msg, line);
+    sprintf(line, "Server: Squid/%s\r\n", SQUID_VERSION);
+    strcat(msg, line);
+    strcat(msg, "\r\n");
+    comm_write(fd,
+       msg,
+       strlen(msg),
+       30,
+       icpSendERRORComplete,
+       (void *) icpState,
+       NULL);
+}
index bababaadcef61c140c55f5a207a76aa549e0e8ff..9a83d9372a116db3f32770e37456b2ef441f6b29 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.51 1996/12/17 07:16:59 wessels Exp $
+ * $Id: url.cc,v 1.52 1997/02/03 23:03:08 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -39,7 +39,8 @@ const char *RequestMethodStr[] =
     "PUT",
     "HEAD",
     "CONNECT",
-    "TRACE"
+    "TRACE",
+    "PURGE"
 };
 
 static char *ProtocolStr[] =
@@ -143,6 +144,8 @@ urlParseMethod(const char *s)
        return METHOD_CONNECT;
     } else if (strcasecmp(s, "TRACE") == 0) {
        return METHOD_TRACE;
+    } else if (strcasecmp(s, "PURGE") == 0) {
+       return METHOD_PURGE;
     }
     return METHOD_NONE;
 }