diff --git a/Libraries/LibCore/CHttpJob.cpp b/Libraries/LibCore/CHttpJob.cpp index 4a65146d9c..96193eb5a5 100644 --- a/Libraries/LibCore/CHttpJob.cpp +++ b/Libraries/LibCore/CHttpJob.cpp @@ -5,19 +5,22 @@ #include #include - -#define CHTTPJOB_DEBUG +//#define CHTTPJOB_DEBUG static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& content_encoding) { +#ifdef CHTTPJOB_DEBUG dbg() << "CHttpJob::handle_content_encoding: buf has content_encoding = " << content_encoding; +#endif if (content_encoding == "gzip") { if (!CGzip::is_compressed(buf)) { dbg() << "CHttpJob::handle_content_encoding: buf is not gzip compressed!"; } +#ifdef CHTTPJOB_DEBUG dbg() << "CHttpJob::handle_content_encoding: buf is gzip compressed!"; +#endif auto uncompressed = CGzip::decompress(buf); if (!uncompressed.has_value()) { @@ -25,9 +28,11 @@ static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& c return buf; } +#ifdef CHTTPJOB_DEBUG dbg() << "CHttpJob::handle_content_encoding: Gzip::decompress() successful.\n" << " Input size = " << buf.size() << "\n" << " Output size = " << uncompressed.value().size(); +#endif return uncompressed.value(); } diff --git a/Libraries/LibCore/CSocket.cpp b/Libraries/LibCore/CSocket.cpp index f652274b2e..f4c1804c08 100644 --- a/Libraries/LibCore/CSocket.cpp +++ b/Libraries/LibCore/CSocket.cpp @@ -30,7 +30,9 @@ bool CSocket::connect(const String& hostname, int port) } IPv4Address host_address((const u8*)hostent->h_addr_list[0]); +#ifdef CSOCKET_DEBUG dbg() << "CSocket::connect: Resolved '" << hostname << "' to " << host_address; +#endif return connect(host_address, port); } @@ -49,7 +51,9 @@ bool CSocket::connect(const CSocketAddress& address, int port) { ASSERT(!is_connected()); ASSERT(address.type() == CSocketAddress::Type::IPv4); +#ifdef CSOCKET_DEBUG dbg() << *this << " connecting to " << address << "..."; +#endif ASSERT(port > 0 && port <= 65535); @@ -70,7 +74,9 @@ bool CSocket::connect(const CSocketAddress& address) { ASSERT(!is_connected()); ASSERT(address.type() == CSocketAddress::Type::Local); +#ifdef CSOCKET_DEBUG dbg() << *this << " connecting to " << address << "..."; +#endif sockaddr_un saddr; saddr.sun_family = AF_LOCAL; @@ -84,10 +90,14 @@ bool CSocket::common_connect(const struct sockaddr* addr, socklen_t addrlen) int rc = ::connect(fd(), addr, addrlen); if (rc < 0) { if (errno == EINPROGRESS) { +#ifdef CSOCKET_DEBUG dbg() << *this << " connection in progress (EINPROGRESS)"; +#endif m_notifier = CNotifier::construct(fd(), CNotifier::Event::Write, this); m_notifier->on_ready_to_write = [this] { +#ifdef CSOCKET_DEBUG dbg() << *this << " connected!"; +#endif m_connected = true; ensure_read_notifier(); m_notifier->set_event_mask(CNotifier::Event::None); @@ -99,7 +109,9 @@ bool CSocket::common_connect(const struct sockaddr* addr, socklen_t addrlen) perror("CSocket::common_connect: connect"); return false; } +#ifdef CSOCKET_DEBUG dbg() << *this << " connected ok!"; +#endif m_connected = true; ensure_read_notifier(); if (on_connected)