From: Alex Rousskov Date: Wed, 18 Jul 2012 03:57:10 +0000 (-0600) Subject: Bug 3525: Do not resend nibbled PUTs and avoid "mustAutoConsume" assertion. X-Git-Tag: sourceformat-review-1~176 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b9899f7845d62d8dc8179166c7dde66c12da712;p=thirdparty%2Fsquid.git Bug 3525: Do not resend nibbled PUTs and avoid "mustAutoConsume" assertion. The connected_okay flag was not set when we were reusing the connection. The unset flag overwrote bodyNibbled() check, allowing FwdState to retry a PUT after the failed transaction consumed some of the request body buffer, triggering BodyPipe.cc:239: "mustAutoConsume" assertion. We now set the connected_okay flag as soon as we get a usable connection and do not allow it to overwrite the bodyNibbled() check (just in case). --- diff --git a/src/forward.cc b/src/forward.cc index 6961046a74..5b8d3ddb3d 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -485,6 +485,9 @@ FwdState::checkRetry() if (flags.dont_retry) return false; + if (request->bodyNibbled()) + return false; + // NP: not yet actually connected anywhere. retry is safe. if (!flags.connected_okay) return true; @@ -492,9 +495,6 @@ FwdState::checkRetry() if (!checkRetriable()) return false; - if (request->bodyNibbled()) - return false; - return true; } @@ -755,6 +755,7 @@ FwdState::connectDone(const Comm::ConnectionPointer &conn, comm_err_t status, in } serverConn = conn; + flags.connected_okay = true; debugs(17, 3, HERE << serverConnection() << ": '" << entry->url() << "'" ); @@ -773,7 +774,6 @@ FwdState::connectDone(const Comm::ConnectionPointer &conn, comm_err_t status, in } #endif - flags.connected_okay = true; dispatch(); } @@ -850,6 +850,7 @@ FwdState::connectStart() else serverConn = NULL; if (Comm::IsConnOpen(serverConn)) { + flags.connected_okay = true; #if 0 if (!serverConn->getPeer()) serverConn->peerType = HIER_DIRECT; @@ -891,6 +892,7 @@ FwdState::connectStart() // if we found an open persistent connection to use. use it. if (openedPconn) { serverConn = temp; + flags.connected_okay = true; debugs(17, 3, HERE << "reusing pconn " << serverConnection()); n_tries++;