ReplyHeaderStrategy.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_SRC_ACL_REPLYHEADERSTRATEGY_H
10 #define SQUID_SRC_ACL_REPLYHEADERSTRATEGY_H
11 
12 #include "acl/Data.h"
13 #include "acl/FilledChecklist.h"
14 #include "acl/ParameterizedNode.h"
16 #include "HttpReply.h"
17 
18 namespace Acl
19 {
20 
22 template <Http::HdrType header>
23 class ReplyHeaderCheck: public ParameterizedNode< ACLData<const char *> >
24 {
25 public:
26  /* Acl::Node API */
27  int match(ACLChecklist *) override;
28  bool requiresReply() const override {return true;}
29 };
30 
31 } // namespace Acl
32 
33 template <Http::HdrType header>
34 int
36 {
37  const auto checklist = Filled(ch);
38 
39  const auto theHeader = checklist->reply().header.getStr(header);
40 
41  if (nullptr == theHeader)
42  return 0;
43 
44  return data->match(theHeader);
45 }
46 
47 #endif /* SQUID_SRC_ACL_REPLYHEADERSTRATEGY_H */
48 
matches the value of a given reply header (e.g., "rep_mime_type" ACL)
Definition: Acl.cc:33
bool requiresReply() const override
whether our (i.e. shallow) match() requires checklist to have a reply
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.

 

Introduction

Documentation

Support

Miscellaneous