From f31a8f08ec829eadc918bcf40a678fa3f0807bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 15 Aug 2025 18:08:41 +0200 Subject: [PATCH] HTTP error logging fixes --- Common/Net/HTTPClient.cpp | 5 +++++ Common/Net/NetBuffer.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index b7b1a09916..1e54544626 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -387,6 +387,11 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & return -1; } + if (readbuf->empty()) { + ERROR_LOG(Log::HTTP, "Empty HTTP header read buffer :("); + return -1; + } + // Grab the first header line that contains the http code. std::string line; diff --git a/Common/Net/NetBuffer.cpp b/Common/Net/NetBuffer.cpp index 5bf15946e9..24a649745a 100644 --- a/Common/Net/NetBuffer.cpp +++ b/Common/Net/NetBuffer.cpp @@ -46,7 +46,7 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) { int sent = send(sock, &data[pos], end - pos, MSG_NOSIGNAL); // TODO: Do we need some retry logic here, instead of just giving up? if (sent < 0) { - ERROR_LOG(Log::IO, "FlushSocket failed to send: %d", errno); + ERROR_LOG(Log::IO, "FlushSocket failed to send: errno=%d", errno); return false; } pos += sent;