]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ConnectionsEncrypted.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / acl / ConnectionsEncrypted.cc
1 /*
2 * Copyright (C) 1996-2016 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 /* DEBUG: section 28 Access Control */
10
11 #include "squid.h"
12 #include "acl/ConnectionsEncrypted.h"
13 #include "acl/FilledChecklist.h"
14 #include "Debug.h"
15 #include "HttpReply.h"
16 #include "HttpRequest.h"
17 #include "SquidConfig.h"
18
19 ACL *
20 Acl::ConnectionsEncrypted::clone() const
21 {
22 return new Acl::ConnectionsEncrypted(*this);
23 }
24
25 Acl::ConnectionsEncrypted::ConnectionsEncrypted (char const *theClass) : class_ (theClass)
26 {}
27
28 Acl::ConnectionsEncrypted::ConnectionsEncrypted (Acl::ConnectionsEncrypted const & old) :class_ (old.class_)
29 {}
30
31 Acl::ConnectionsEncrypted::~ConnectionsEncrypted()
32 {}
33
34 char const *
35 Acl::ConnectionsEncrypted::typeString() const
36 {
37 return class_;
38 }
39
40 bool
41 Acl::ConnectionsEncrypted::empty () const
42 {
43 return false;
44 }
45
46 void
47 Acl::ConnectionsEncrypted::parse()
48 {
49 if (ConfigParser::strtokFile()) {
50 debugs(89, DBG_CRITICAL, "WARNING: connections_encrypted does not accepts any value.");
51 }
52 }
53
54 int
55 Acl::ConnectionsEncrypted::match(ACLChecklist *checklist)
56 {
57 if (!checklist->hasRequest()) {
58 debugs(28, DBG_IMPORTANT, "WARNING: " << name << " ACL is used in " <<
59 "context without an HTTP request. Assuming mismatch.");
60 return 0;
61 }
62
63 ACLFilledChecklist *filled = Filled((ACLChecklist*)checklist);
64
65 const bool safeRequest =
66 !(filled->request->sources & HttpMsg::srcUnsafe);
67 const bool safeReply = !filled->reply ||
68 !(filled->reply->sources & HttpMsg::srcUnsafe);
69
70 return (safeRequest && safeReply) ? 1 : 0;
71 }
72
73 SBufList
74 Acl::ConnectionsEncrypted::dump() const
75 {
76 return SBufList();
77 }
78