]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Answer.cc
CI: Upgrade GitHub Setup Node and CodeQL actions to Node 20 (#1845)
[thirdparty/squid.git] / src / adaptation / Answer.cc
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 /* DEBUG: section 93 ICAP (RFC 3507) Client */
10
11 #include "squid.h"
12 #include "adaptation/Answer.h"
13 #include "base/AsyncJobCalls.h"
14 #include "http/Message.h"
15
16 Adaptation::Answer
17 Adaptation::Answer::Error(bool final)
18 {
19 Answer answer(akError);
20 answer.final = final;
21 debugs(93, 4, "error: " << final);
22 return answer;
23 }
24
25 Adaptation::Answer
26 Adaptation::Answer::Forward(Http::Message *aMsg)
27 {
28 Answer answer(akForward);
29 answer.message = aMsg;
30 debugs(93, 4, "forwarding: " << (void*)aMsg);
31 return answer;
32 }
33
34 Adaptation::Answer
35 Adaptation::Answer::Block(const SBuf &aRule)
36 {
37 Answer answer(akBlock);
38 answer.ruleId = aRule;
39 debugs(93, 4, "blocking rule: " << aRule);
40 return answer;
41 }
42
43 Acl::Answer
44 Adaptation::Answer::blockedToChecklistAnswer() const
45 {
46 assert(kind == akBlock);
47 Acl::Answer answer(ACCESS_DENIED);
48 answer.lastCheckedName = ruleId;
49 return answer;
50 }
51
52 std::ostream &
53 Adaptation::Answer::print(std::ostream &os) const
54 {
55 return os << kind; // TODO: add more details
56 }
57
58 Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
59 {
60 }
61