]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ReplyHeaderStrategy.h
2 * Copyright (C) 1996-2015 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_ACLREPLYHEADERSTRATEGY_H
10 #define SQUID_ACLREPLYHEADERSTRATEGY_H
16 #include "acl/FilledChecklist.h"
17 #include "acl/Strategy.h"
18 #include "HttpReply.h"
20 template <http_hdr_type header
>
21 class ACLReplyHeaderStrategy
: public ACLStrategy
<char const *>
25 virtual int match (ACLData
<char const *> * &, ACLFilledChecklist
*, ACLFlags
&);
26 virtual bool requiresReply() const {return true;}
28 static ACLReplyHeaderStrategy
*Instance();
29 /* Not implemented to prevent copies of the instance. */
30 /* Not private to prevent brain dead g+++ warnings about
31 * private constructors with no friends */
32 ACLReplyHeaderStrategy(ACLReplyHeaderStrategy
const &);
35 static ACLReplyHeaderStrategy
*Instance_
;
36 ACLReplyHeaderStrategy() {}
38 ACLReplyHeaderStrategy
&operator=(ACLReplyHeaderStrategy
const &);
41 template <http_hdr_type header
>
43 ACLReplyHeaderStrategy
<header
>::match (ACLData
<char const *> * &data
, ACLFilledChecklist
*checklist
, ACLFlags
&)
45 char const *theHeader
= checklist
->reply
->header
.getStr(header
);
47 if (NULL
== theHeader
)
50 return data
->match(theHeader
);
53 template <http_hdr_type header
>
54 ACLReplyHeaderStrategy
<header
> *
55 ACLReplyHeaderStrategy
<header
>::Instance()
58 Instance_
= new ACLReplyHeaderStrategy
<header
>;
63 template <http_hdr_type header
>
64 ACLReplyHeaderStrategy
<header
> * ACLReplyHeaderStrategy
<header
>::Instance_
= NULL
;
66 #endif /* SQUID_REPLYHEADERSTRATEGY_H */