]> git.ipfire.org Git - thirdparty/squid.git/blame - src/clients/HttpTunnelerAnswer.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / clients / HttpTunnelerAnswer.h
CommitLineData
f5e17947 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
f5e17947
CT
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#ifndef SQUID_SRC_CLIENTS_HTTP_TUNNELERANSWER_H
10#define SQUID_SRC_CLIENTS_HTTP_TUNNELERANSWER_H
11
12#include "base/CbcPointer.h"
13#include "comm/forward.h"
14#include "http/StatusCode.h"
15#include "sbuf/SBuf.h"
16
17class ErrorState;
18
19namespace Http {
20
21/// Three mutually exclusive answers are possible:
22///
23/// * Squid-generated error object (TunnelerAnswer::squidError);
24/// * peer-generated error message (TunnelerAnswer::peerError);
25/// * successful tunnel establishment (none of the above are present).
26///
27/// HTTP CONNECT tunnel setup results (supplied via a callback). The tunnel
28/// through the peer was established if and only if the error member is nil.
29class TunnelerAnswer
30{
31public:
32 TunnelerAnswer() {}
33 ~TunnelerAnswer(); ///< deletes squidError if it is still set
34
35 bool positive() const { return !squidError; }
36
37 // Destructor will erase squidError if it is still set. Answer recipients
38 // must clear this member to keep its info.
39 // XXX: We should refcount ErrorState instead of cbdata-protecting it.
40 CbcPointer<ErrorState> squidError; ///< problem details (or nil)
41
42 SBuf leftovers; ///< peer-generated bytes after a positive answer (or empty)
43
44 /// the status code of the successfully parsed CONNECT response (or scNone)
45 StatusCode peerResponseStatus = scNone;
25b0ce45
CT
46
47 Comm::ConnectionPointer conn;
f5e17947
CT
48};
49
25ecffe5 50std::ostream &operator <<(std::ostream &, const TunnelerAnswer &);
f5e17947 51
2f8abb64 52} // namespace Http
f5e17947
CT
53
54#endif /* SQUID_SRC_CLIENTS_HTTP_TUNNELERANSWER_H */
55