DEFAULT: none
DEFAULT_DOC: Deny, unless rules exist in squid.conf.
DOC_START
- Allowing or Denying access to the HTCP port based on defined
- access lists
+ Controls whether HTCP TST requests received on htcp_port are allowed.
htcp_access allow|deny [!]aclname ...
- See also htcp_clr_access for details on access control for
- cache purge (CLR) HTCP messages.
+ This directive does not control whether HTCP CLR requests are allowed.
+ Use htcp_clr_access directive for that.
+
+ This directive does not control whether HTCP requests with other opcodes
+ are allowed (e.g., NOP, MON, and SET). Squid ignores those HTCP requests.
NOTE: The default if no htcp_access lines are present is to
- deny all traffic. This default may cause problems with peers
+ deny all HTCP TST traffic. This default may cause problems with peers
using the htcp option.
This clause only supports fast acl types.
See https://wiki.squid-cache.org/SquidFaq/SquidAcl for details.
-# Allow HTCP queries from local networks only
+# Allow HTCP TST queries from local networks only
#htcp_access allow localnet
#htcp_access deny all
DOC_END
DEFAULT: none
DEFAULT_DOC: Deny, unless rules exist in squid.conf.
DOC_START
- Allowing or Denying access to purge content using HTCP based
- on defined access lists.
- See htcp_access for details on general HTCP access control.
+ Controls whether HTCP CLR requests received on htcp_port are allowed.
+ See htcp_access for controlling other HTCP messages.
htcp_clr_access allow|deny [!]aclname ...
+ HTCP CLR requests purge matching cached entries. They may be forwarded to
+ specially marked cache_peers (see cache_peer HTCP options for details).
+
This clause only supports fast acl types.
See https://wiki.squid-cache.org/SquidFaq/SquidAcl for details.
}
static void
-htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, Ip::Address &from)
+htcpHandleClr(htcpDataHeader * const hdr, char * const buf, const int sz, Ip::Address &from)
{
/* buf[0/1] is reserved and reason */
if (sz < 2) {
}
int reason = static_cast<unsigned char>(buf[1]) << 4;
debugs(31, 2, "HTCP CLR reason: " << reason);
- buf += 2;
- sz -= 2;
- /* buf should be a SPECIFIER */
+ const auto specifierStart = buf + 2;
+ const auto specifierSize = sz - 2;
if (sz == 0) {
debugs(31, 4, "nothing to do");
return;
}
- htcpSpecifier::Pointer s(htcpUnpackSpecifier(buf, sz));
+ const auto s = htcpUnpackSpecifier(specifierStart, specifierSize);
if (!s) {
debugs(31, 3, "htcpUnpackSpecifier failed");
default:
break;
}
-}
-/*
- * Forward a CLR request to all peers who have requested that CLRs be
- * forwarded to them.
- */
-static void
-htcpForwardClr(char *buf, int sz)
-{
+ // Forward this CLR request to all peers who have requested that CLRs be
+ // forwarded to them.
+ // TODO: Consider not forwarding requests with htcpClrStore() < 0.
for (const auto &p: CurrentCachePeers()) {
if (!p->options.htcp) {
continue;
break;
case HTCP_CLR:
htcpHandleClr(&hdr, hbuf, hsz, from);
- htcpForwardClr(buf, sz);
break;
default:
break;