]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3525: Do not resend nibbled PUTs and avoid "mustAutoConsume" assertion.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Jul 2012 03:57:10 +0000 (21:57 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Jul 2012 03:57:10 +0000 (21:57 -0600)
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).

src/forward.cc

index 6961046a747096b5b716e796513f4edb020f8bc1..5b8d3ddb3da9ad9dc2fb79750f64d0ddc853c25c 100644 (file)
@@ -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++;