]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/RequestHeaderStrategy.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H
10 #define SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H
13 #include "acl/FilledChecklist.h"
14 #include "acl/ParameterizedNode.h"
15 #include "HttpRequest.h"
20 /// matches the value of a given request header (e.g., "browser" or "referer_regex")
21 template <Http::HdrType header
>
22 class RequestHeaderCheck
: public ParameterizedNode
< ACLData
<const char *> >
26 int match(ACLChecklist
*) override
;
27 bool requiresRequest() const override
{return true;}
32 template <Http::HdrType header
>
34 Acl::RequestHeaderCheck
<header
>::match(ACLChecklist
* const ch
)
36 const auto checklist
= Filled(ch
);
38 char const *theHeader
= checklist
->request
->header
.getStr(header
);
40 if (nullptr == theHeader
)
43 return data
->match(theHeader
);
46 #endif /* SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H */