Bug 1269055 - If a connection is reused, retry requests even if the request method is not safe (revert to old(ff45) behavior).r=mcmanus a=lizzard
authorDragana Damjanovic <dd.mozilla@gmail.com>
Tue, 03 May 2016 17:39:30 -0700
changeset 332720 314eb11784ea640cb1719d220efe3e588253692b
parent 332719 372b3480067a80e47d4394aafe1e0e4f13427cfe
child 332721 995ecc8dbf0b3a5337784766ee575934cb61df03
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, lizzard
bugs1269055
milestone48.0a2
Bug 1269055 - If a connection is reused, retry requests even if the request method is not safe (revert to old(ff45) behavior).r=mcmanus a=lizzard MozReview-Commit-ID: INw61hHzvDl
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -919,16 +919,22 @@ nsHttpTransaction::Close(nsresult reason
         // report that this transaction is closing
         mActivityDistributor->ObserveActivity(
             mChannel,
             NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
             NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE,
             PR_Now(), 0, EmptyCString());
     }
 
+    // we must no longer reference the connection!  find out if the
+    // connection was being reused before letting it go.
+    bool connReused = false;
+    if (mConnection) {
+        connReused = mConnection->IsReused();
+    }
     mConnected = false;
     mTunnelProvider = nullptr;
 
     //
     // if the connection was reset or closed before we wrote any part of the
     // request or if we wrote the request but didn't receive any part of the
     // response and the connection was being reused, then we can (and really
     // should) assume that we wrote to a stale connection and we must therefore
@@ -972,17 +978,17 @@ nsHttpTransaction::Close(nsresult reason
         // reallySentData is meant to separate the instances where data has
         // been sent by this transaction but buffered at a higher level while
         // a TLS session (perhaps via a tunnel) is setup.
         bool reallySentData =
             mSentData && (!mConnection || mConnection->BytesWritten());
 
         if (!mReceivedData &&
             ((mRequestHead && mRequestHead->IsSafeMethod()) ||
-             !reallySentData)) {
+             !reallySentData || connReused)) {
             // if restarting fails, then we must proceed to close the pipe,
             // which will notify the channel that the transaction failed.
 
             if (mPipelinePosition) {
                 gHttpHandler->ConnMgr()->PipelineFeedbackInfo(
                     mConnInfo, nsHttpConnectionMgr::RedCanceledPipeline,
                     nullptr, 0);
             }