From: Alex Rousskov Date: Sat, 25 Oct 2025 10:07:58 +0000 (+0000) Subject: Maintenance: Drop HttpStateData::handleMoreRequestBodyAvailable (#2286) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc3d750eb3c02e3eec86e40d364da214cf05c967;p=thirdparty%2Fsquid.git Maintenance: Drop HttpStateData::handleMoreRequestBodyAvailable (#2286) The method is unreachable: It was supposed to be a virtual method. It is declared as such in HttpStateData class, but it should have been declared virtual in Client (i.e. the _parent_ class). Without that virtual declaration in Client, the caller calls a Client method with the same name instead. This code became unreachable in 2007 commit 5f8252d2. The current method implementation is unusable: There are two explicit XXXs, excessive (and unclassified) level-1 debugging, and an infinite recursion added in the same 2007 commit 5f8252d2. It is possible to refactor this method implementation to address known concerns. We decided to remove this method instead because proper refactoring is costly and is likely to result in this method removal. The infinite recursion concern was raised by Joshua Rogers https://joshua.hu/ --- diff --git a/src/http.cc b/src/http.cc index a43b2b504f..42ee7ec24a 100644 --- a/src/http.cc +++ b/src/http.cc @@ -2621,38 +2621,6 @@ HttpStateData::doneSendingRequestBody() sendComplete(); } -// more origin request body data is available -void -HttpStateData::handleMoreRequestBodyAvailable() -{ - if (eof || !Comm::IsConnOpen(serverConnection)) { - // XXX: we should check this condition in other callbacks then! - // TODO: Check whether this can actually happen: We should unsubscribe - // as a body consumer when the above condition(s) are detected. - debugs(11, DBG_IMPORTANT, "Transaction aborted while reading HTTP body"); - return; - } - - assert(requestBodySource != nullptr); - - if (requestBodySource->buf().hasContent()) { - // XXX: why does not this trigger a debug message on every request? - - if (flags.headers_parsed && !flags.abuse_detected) { - flags.abuse_detected = true; - debugs(11, DBG_IMPORTANT, "http handleMoreRequestBodyAvailable: Likely proxy abuse detected '" << request->client_addr << "' -> '" << entry->url() << "'" ); - - if (virginReply()->sline.status() == Http::scInvalidHeader) { - closeServer(); - mustStop("HttpStateData::handleMoreRequestBodyAvailable"); - return; - } - } - } - - HttpStateData::handleMoreRequestBodyAvailable(); -} - // premature end of the request body void HttpStateData::handleRequestBodyProducerAborted() diff --git a/src/http.h b/src/http.h index e5f8fdb384..c5f14a9a66 100644 --- a/src/http.h +++ b/src/http.h @@ -121,8 +121,6 @@ private: std::optional canBufferMoreReplyBytes() const; size_t maybeMakeSpaceAvailable(size_t maxReadSize); - // consuming request body - virtual void handleMoreRequestBodyAvailable(); void handleRequestBodyProducerAborted() override; void writeReplyBody(); diff --git a/src/http/StateFlags.h b/src/http/StateFlags.h index 52b86f5eda..8f4dd28ccc 100644 --- a/src/http/StateFlags.h +++ b/src/http/StateFlags.h @@ -56,7 +56,6 @@ public: bool toOriginPeer() const { return toOrigin && peering && !tunneling; } bool keepalive_broken = false; - bool abuse_detected = false; bool request_sent = false; bool chunked = false; ///< reading a chunked response; TODO: rename bool chunked_request = false; ///< writing a chunked request