From: Peter van Dijk Date: Wed, 5 Feb 2020 12:47:52 +0000 (+0100) Subject: sdig stdin: attempt to decode proxy headers X-Git-Tag: dnsdist-1.5.0-alpha1~12^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78b4af69f0903e21042feae2963504ddad00b99e;p=thirdparty%2Fpdns.git sdig stdin: attempt to decode proxy headers --- diff --git a/pdns/sdig.cc b/pdns/sdig.cc index 22f759e1ca..9aa5ccd6db 100644 --- a/pdns/sdig.cc +++ b/pdns/sdig.cc @@ -317,7 +317,19 @@ try { } else if (fromstdin) { std::istreambuf_iterator begin(std::cin), end; reply = string(begin, end); - if (tcp) reply = reply.substr(2); + + ComboAddress source, destination; + bool wastcp; + ssize_t offset = parseProxyHeader(reply.c_str(), reply.size(), source, destination, wastcp); + if (offset) { + cout<<"proxy "<<(wastcp ? "tcp" : "udp")<<" headersize="<