Squid Web Cache
master
Loading...
Searching...
No Matches
RequestHeaderStrategy.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
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.
7
*/
8
9
#ifndef SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H
10
#define SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H
11
12
#include "
acl/Data.h
"
13
#include "
acl/FilledChecklist.h
"
14
#include "
acl/ParameterizedNode.h
"
15
#include "
HttpRequest.h
"
16
17
namespace
Acl
18
{
19
21
template
<Http::HdrType header>
22
class
RequestHeaderCheck
:
public
ParameterizedNode
< ACLData<const char *> >
23
{
24
public
:
25
/* Acl::Node API */
26
int
match
(
ACLChecklist
*)
override
;
27
bool
requiresRequest
()
const override
{
return
true
;}
28
};
29
30
}
// namespace Acl
31
32
template
<Http::HdrType header>
33
int
34
Acl::RequestHeaderCheck<header>::match
(
ACLChecklist
*
const
ch)
35
{
36
const
auto
checklist =
Filled
(ch);
37
38
char
const
*theHeader = checklist->request->header.getStr(header);
39
40
if
(
nullptr
== theHeader)
41
return
0;
42
43
return
data->match(theHeader);
44
}
45
46
#endif
/* SQUID_SRC_ACL_REQUESTHEADERSTRATEGY_H */
47
Data.h
FilledChecklist.h
Filled
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
Definition
FilledChecklist.h:146
HttpRequest.h
ParameterizedNode.h
ACLChecklist
Definition
Checklist.h:31
Acl::ParameterizedNode
Definition
ParameterizedNode.h:24
Acl::RequestHeaderCheck
matches the value of a given request header (e.g., "browser" or "referer_regex")
Definition
RequestHeaderStrategy.h:23
Acl::RequestHeaderCheck::match
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.
Definition
RequestHeaderStrategy.h:34
Acl::RequestHeaderCheck::requiresRequest
bool requiresRequest() const override
whether our (i.e. shallow) match() requires checklist to have a request
Definition
RequestHeaderStrategy.h:27
Acl
Definition
Acl.cc:33
squid
src
acl
RequestHeaderStrategy.h
Generated by
1.9.8