RequestHeaderStrategy.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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_ACLREQUESTHEADERSTRATEGY_H
10#define SQUID_ACLREQUESTHEADERSTRATEGY_H
11
12#include "acl/Data.h"
13#include "acl/FilledChecklist.h"
15#include "HttpRequest.h"
16
17namespace Acl
18{
19
21template <Http::HdrType header>
22class RequestHeaderCheck: public ParameterizedNode< ACLData<const char *> >
23{
24public:
25 /* ACL API */
26 int match(ACLChecklist *) override;
27 bool requiresRequest() const override {return true;}
28};
29
30} // namespace Acl
31
32template <Http::HdrType header>
33int
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_REQUESTHEADERSTRATEGY_H */
47
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
matches the value of a given request header (e.g., "browser" or "referer_regex")
int match(ACLChecklist *) override
Matches the actual data in checklist against this ACL.
bool requiresRequest() const override
whether our (i.e. shallow) match() requires checklist to have a request
Definition: Acl.cc:31

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors