]> git.ipfire.org Git - thirdparty/squid.git/blob - src/clients/HttpTunnelerAnswer.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / clients / HttpTunnelerAnswer.cc
1 /*
2 * Copyright (C) 1996-2020 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 #include "squid.h"
10 #include "clients/HttpTunnelerAnswer.h"
11 #include "comm/Connection.h"
12 #include "errorpage.h"
13
14 Http::TunnelerAnswer::~TunnelerAnswer()
15 {
16 delete squidError.get();
17 }
18
19 std::ostream &
20 Http::operator <<(std::ostream &os, const TunnelerAnswer &answer)
21 {
22 os << '[';
23
24 if (const auto squidError = answer.squidError.get()) {
25 os << "SquidErr:" << squidError->page_id;
26 } else {
27 os << "OK";
28 if (const auto extraBytes = answer.leftovers.length())
29 os << '+' << extraBytes;
30 }
31
32 if (answer.peerResponseStatus != Http::scNone)
33 os << ' ' << answer.peerResponseStatus;
34
35 os << ']';
36 return os;
37 }
38