]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/Answer.cc
mkrelease: allow two digits for minor release numbers (#1837)
[thirdparty/squid.git] / src / adaptation / Answer.cc
CommitLineData
1adcebc3 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
bbc27441
AJ
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.
1adcebc3
AR
7 */
8
bbc27441
AJ
9/* DEBUG: section 93 ICAP (RFC 3507) Client */
10
f7f3304a 11#include "squid.h"
1adcebc3
AR
12#include "adaptation/Answer.h"
13#include "base/AsyncJobCalls.h"
63df1d28 14#include "http/Message.h"
1adcebc3
AR
15
16Adaptation::Answer
17Adaptation::Answer::Error(bool final)
18{
19 Answer answer(akError);
20 answer.final = final;
bf95c10a 21 debugs(93, 4, "error: " << final);
1adcebc3
AR
22 return answer;
23}
24
25Adaptation::Answer
63df1d28 26Adaptation::Answer::Forward(Http::Message *aMsg)
1adcebc3
AR
27{
28 Answer answer(akForward);
29 answer.message = aMsg;
bf95c10a 30 debugs(93, 4, "forwarding: " << (void*)aMsg);
1adcebc3
AR
31 return answer;
32}
33
1adcebc3 34Adaptation::Answer
25aa6c9a 35Adaptation::Answer::Block(const SBuf &aRule)
1adcebc3
AR
36{
37 Answer answer(akBlock);
38 answer.ruleId = aRule;
bf95c10a 39 debugs(93, 4, "blocking rule: " << aRule);
1adcebc3
AR
40 return answer;
41}
42
25aa6c9a
AR
43Acl::Answer
44Adaptation::Answer::blockedToChecklistAnswer() const
45{
46 assert(kind == akBlock);
47 Acl::Answer answer(ACCESS_DENIED);
48 answer.lastCheckedName = ruleId;
49 return answer;
50}
51
1adcebc3
AR
52std::ostream &
53Adaptation::Answer::print(std::ostream &os) const
54{
55 return os << kind; // TODO: add more details
56}
57
58Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
59{
60}
f53969cc 61