]> git.ipfire.org Git - thirdparty/squid.git/blame_incremental - src/adaptation/Answer.cc
Simplify appending SBuf to String (#2108)
[thirdparty/squid.git] / src / adaptation / Answer.cc
... / ...
CommitLineData
1/*
2 * Copyright (C) 1996-2025 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
16Adaptation::Answer
17Adaptation::Answer::Error(bool final)
18{
19 Answer answer(akError);
20 answer.final = final;
21 debugs(93, 4, "error: " << final);
22 return answer;
23}
24
25Adaptation::Answer
26Adaptation::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
34Adaptation::Answer
35Adaptation::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
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
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}
61