net/Socket.cpp | 33 ++++++++++++++++++++------------- wsd/LOOLWSD.cpp | 4 +++- 2 files changed, 23 insertions(+), 14 deletions(-)
New commits: commit 473c511cc019f64e1e0d1e95f223796a5b6182e7 Author: Michael Meeks <[email protected]> Date: Fri May 12 03:06:31 2017 +0100 DumpState: include SSL & termination settings. Change-Id: I14d1d79d5ab1650661c493d8965cf41ac84c17c1 diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 1d48c254..99208078 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2226,6 +2226,8 @@ public: os << "LOOLWSDServer:\n" << " Ports: server " << ClientPortNumber << " prisoner " << MasterPortNumber << "\n" + << " SSL: " << (LOOLWSD::isSSLEnabled() ? "https" : "http") << "\n" + << " SSL-Termination: " << (LOOLWSD::isSSLTermination() ? "yes" : "no") << "\n" << " TerminationFlag: " << TerminationFlag << "\n" << " isShuttingDown: " << ShutdownRequestFlag << "\n" << " NewChildren: " << NewChildren.size() << "\n" commit 29b92444b1998d8744e7e73a2a7f2d57e5042376 Author: Michael Meeks <[email protected]> Date: Fri May 12 03:01:28 2017 +0100 Stream dumpHex output to an output stream. Also output debug directly to stderr to avoid std::cerr re-direction. Change-Id: Ib2a0eaa3514ef88d7fe8d8fbb3706925aabf3346 diff --git a/net/Socket.cpp b/net/Socket.cpp index 652c7568..97018c86 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -138,30 +138,37 @@ void SocketDisposition::execute() namespace { -void dump_hex (const char *legend, const char *prefix, std::vector<char> buffer) +void dump_hex (std::ostream &os, const char *legend, const char *prefix, std::vector<char> buffer) { unsigned int i, j; - fprintf (stderr, "%s", legend); + char scratch[64]; + + os << legend; for (j = 0; j < buffer.size() + 15; j += 16) { - fprintf (stderr, "%s0x%.4x ", prefix, j); + sprintf (scratch, "%s0x%.4x ", prefix, j); + os << scratch; for (i = 0; i < 16; i++) { if ((j + i) < buffer.size()) - fprintf (stderr, "%.2x ", (unsigned char)buffer[j+i]); + sprintf (scratch, "%.2x ", (unsigned char)buffer[j+i]); else - fprintf (stderr, " "); + sprintf (scratch, " "); + os << scratch; if (i == 8) - fprintf (stderr, " "); + os << " "; } - fprintf (stderr, " | "); + os << " | "; for (i = 0; i < 16; i++) + { if ((j + i) < buffer.size() && ::isprint(buffer[j+i])) - fprintf (stderr, "%c", buffer[j+i]); + sprintf (scratch, "%c", buffer[j+i]); else - fprintf (stderr, "."); - fprintf (stderr, "\n"); + sprintf (scratch, "."); + os << scratch; + } + os << "\n"; } } @@ -172,7 +179,7 @@ void WebSocketHandler::dumpState(std::ostream& os) os << (_shuttingDown ? "shutd " : "alive ") << std::setw(5) << 1.0*_pingTimeUs/1000 << "ms "; if (_wsPayload.size() > 0) - dump_hex("\t\tws queued payload:\n", "\t\t", _wsPayload); + dump_hex(os, "\t\tws queued payload:\n", "\t\t", _wsPayload); } void StreamSocket::dumpState(std::ostream& os) @@ -183,9 +190,9 @@ void StreamSocket::dumpState(std::ostream& os) << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"; _socketHandler->dumpState(os); if (_inBuffer.size() > 0) - dump_hex("\t\tinBuffer:\n", "\t\t", _inBuffer); + dump_hex(os, "\t\tinBuffer:\n", "\t\t", _inBuffer); if (_outBuffer.size() > 0) - dump_hex("\t\toutBuffer:\n", "\t\t", _inBuffer); + dump_hex(os, "\t\toutBuffer:\n", "\t\t", _inBuffer); } void StreamSocket::send(Poco::Net::HTTPResponse& response) diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index bdf0f67d..1d48c254 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2647,7 +2647,7 @@ void dump_state() srv.dumpState(oss); const std::string msg = oss.str(); - std::cerr << msg << std::endl; + fprintf(stderr, "%s\n", msg.c_str()); LOG_TRC(msg); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
