/*
- * $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
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;
}
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;
}
/*
- * $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
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);
+}
/*
- * $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
"PUT",
"HEAD",
"CONNECT",
- "TRACE"
+ "TRACE",
+ "PURGE"
};
static char *ProtocolStr[] =
return METHOD_CONNECT;
} else if (strcasecmp(s, "TRACE") == 0) {
return METHOD_TRACE;
+ } else if (strcasecmp(s, "PURGE") == 0) {
+ return METHOD_PURGE;
}
return METHOD_NONE;
}