#endif
// implemented in client_side_reply.cc until sides have a common parent
-extern void purgeEntriesByUrl(const char *url);
+extern void purgeEntriesByUrl(HttpRequest * req, const char *url);
ServerStateData::ServerStateData(FwdState *theFwdState): AsyncJob("ServerStateData"),requestSender(NULL)
// purges entries that match the value of a given HTTP [response] header
static void
-purgeEntriesByHeader(const HttpRequest *req, const char *reqUrl, HttpMsg *rep, http_hdr_type hdr)
+purgeEntriesByHeader(HttpRequest *req, const char *reqUrl, HttpMsg *rep, http_hdr_type hdr)
{
const char *url, *absUrl;
url = absUrl;
}
if (absUrl != NULL) { // if the URL was relative, it is by nature the same host
- purgeEntriesByUrl(url);
+ purgeEntriesByUrl(req, url);
} else if (sameUrlHosts(reqUrl, url)) { // prevent purging DoS, per RFC 2616 13.10, second last paragraph
- purgeEntriesByUrl(url);
+ purgeEntriesByUrl(req, url);
}
if (absUrl != NULL) {
safe_free(absUrl);
// XXX: should we use originalRequest() here?
const char *reqUrl = urlCanonical(request);
debugs(88, 5, "maybe purging due to " << RequestMethodStr(request->method) << ' ' << reqUrl);
- purgeEntriesByUrl(reqUrl);
+ purgeEntriesByUrl(request, reqUrl);
purgeEntriesByHeader(request, reqUrl, theFinalReply, HDR_LOCATION);
purgeEntriesByHeader(request, reqUrl, theFinalReply, HDR_CONTENT_LOCATION);
}
* keys depend on vary headers.
*/
void
-purgeEntriesByUrl(const char *url)
+purgeEntriesByUrl(HttpRequest * req, const char *url)
{
for (HttpRequestMethod m(METHOD_NONE); m != METHOD_ENUM_END; ++m) {
if (m.isCacheble()) {
if (StoreEntry *entry = storeGetPublic(url, m)) {
debugs(88, 5, "purging " << RequestMethodStr(m) << ' ' << url);
entry->release();
+#if USE_HTCP
+ neighborsHtcpClear(NULL, url, req, &m, HTCP_CLR_INVALIDATION);
+#endif
}
}
}
clientReplyContext::purgeAllCached()
{
const char *url = urlCanonical(http->request);
- purgeEntriesByUrl(url);
+ purgeEntriesByUrl(http->request, url);
}
void
DISABLE_PMTU_TRANSPARENT
};
+#if USE_HTCP
+/*
+ * This should be in htcp.h but because neighborsHtcpClear is defined in
+ * protos.h it has to be here.
+ */
+typedef enum {
+ HTCP_CLR_PURGE,
+ HTCP_CLR_INVALIDATION,
+} htcp_clr_reason;
+#endif
+
#endif /* SQUID_ENUMS_H */
{
peer *p;
- for (p = Config.peers; p; p->next) {
+ for (p = Config.peers; p; p = p->next) {
if (!p->options.htcp) {
continue;
}
}
static void
-
-htcpHandleData(char *buf, int sz, IPAddress &from)
-{
-
-}
-
-static void
-
htcpHandle(char *buf, int sz, IPAddress &from)
{
htcpHeader htcpHdr;
return;
}
- hbuf += sizeof(htcpHeader);
- hsz -= sizeof(htcpHeader);
+ hbuf = buf + sizeof(htcpHeader);
+ hsz = sz - sizeof(htcpHeader);
if ((size_t)hsz < sizeof(htcpDataHeader))
{
#include "HttpHeader.h"
#include "IPAddress.h"
-typedef enum {
- HTCP_CLR_PURGE,
- HTCP_CLR_INVALIDATION,
-} htcp_clr_reason;
-
/// \ingroup ServerProtocolHTCP
class HtcpReplyData
{
if (p->options.htcp_no_purge_clr && reason == HTCP_CLR_PURGE) {
continue;
}
- debug(15, 1) ("neighborsHtcpClear: sending CLR to %s\n", p->in_addr->ToURL(buf, 128););
+ debug(15, 1) ("neighborsHtcpClear: sending CLR to %s\n", p->in_addr.ToURL(buf, 128));
htcpClear(e, uri, req, method, p, reason);
}
}
SQUIDCEXTERN void neighbors_init(void);
#if USE_HTCP
SQUIDCEXTERN void neighborsHtcpClear(StoreEntry *, const char *, HttpRequest *, HttpRequestMethod *, htcp_clr_reason);
+#endif
SQUIDCEXTERN peer *peerFindByName(const char *);
SQUIDCEXTERN peer *peerFindByNameAndPort(const char *, unsigned short);
SQUIDCEXTERN peer *getDefaultParent(HttpRequest * request);