bug 739617 - cannot upload large files r=honzab
authorPatrick McManus <mcmanus@ducksong.com>
Mon, 02 Apr 2012 20:36:11 -0400
changeset 90883 ad815bdb133cb89c5be67e47ccd3b23884699218
parent 90882 aca7aac62fa6647916a7c9f2ea55dd2866193c3e
child 90884 9894cd99978190db956376e8ad2320fd600c87ed
push id22394
push userMs2ger@gmail.com
push dateTue, 03 Apr 2012 07:22:53 +0000
treeherdermozilla-central@9894cd999781 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs739617
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 739617 - cannot upload large files r=honzab
modules/libpref/src/init/all.js
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpPipeline.cpp
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -813,17 +813,20 @@ pref("network.http.proxy.pipelining", fa
 pref("network.http.pipelining.maxrequests" , 32);
 
 // An optimistic request is one pipelined when policy might allow a new
 // connection instead
 pref("network.http.pipelining.max-optimistic-requests" , 4);
 
 pref("network.http.pipelining.aggressive", false);
 pref("network.http.pipelining.maxsize" , 300000);
-pref("network.http.pipelining.read-timeout", 10000);
+
+// The read-timeout is a ms timer that causes the transaction to be completely
+// restarted without pipelining. Set to 0 to disable.
+pref("network.http.pipelining.read-timeout", 30000);
 
 // Prompt for 307 redirects
 pref("network.http.prompt-temp-redirect", true);
 
 // If true generate CORRUPTED_CONTENT errors for entities that
 // contain an invalid Assoc-Req response header
 pref("network.http.assoc-req.enforce", false);
 
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -989,29 +989,30 @@ nsHttpConnection::ReadTimeoutTick(PRInte
     if (pipelineDepth > 1) {
         nsHttpPipeline *pipeline = mTransaction->QueryPipeline();
         NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline");
         // code this defensively for the moment and check for null in opt build
         if (pipeline)
             pipeline->CancelPipeline(NS_ERROR_NET_TIMEOUT);
     }
     
-    if (delta < gHttpHandler->GetPipelineTimeout())
+    PRIntervalTime pipelineTimeout = gHttpHandler->GetPipelineTimeout();
+    if (!pipelineTimeout || (delta < pipelineTimeout))
         return;
 
     if (pipelineDepth <= 1 && !mTransaction->PipelinePosition())
         return;
     
     // nothing has transpired on this pipelined socket for many
     // seconds. Call that a total stall and close the transaction.
     // There is a chance the transaction will be restarted again
     // depending on its state.. that will come back araound
     // without pipelining on, so this won't loop.
 
-    LOG(("canceling transaction stalled for %ums on a pipeline"
+    LOG(("canceling transaction stalled for %ums on a pipeline "
          "of depth %d and scheduled originally at pos %d\n",
          PR_IntervalToMilliseconds(delta),
          pipelineDepth, mTransaction->PipelinePosition()));
 
     // This will also close the connection
     CloseTransaction(mTransaction, NS_ERROR_NET_TIMEOUT);
 }
 
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -184,17 +184,17 @@ nsHttpHandler::nsHttpHandler()
     , mMaxConnections(24)
     , mMaxConnectionsPerServer(8)
     , mMaxPersistentConnectionsPerServer(2)
     , mMaxPersistentConnectionsPerProxy(4)
     , mMaxPipelinedRequests(32)
     , mMaxOptimisticPipelinedRequests(4)
     , mPipelineAggressive(false)
     , mMaxPipelineObjectSize(300000)
-    , mPipelineReadTimeout(PR_MillisecondsToInterval(10000))
+    , mPipelineReadTimeout(PR_MillisecondsToInterval(30000))
     , mRedirectionLimit(10)
     , mPhishyUserPassLength(1)
     , mQoSBits(0x00)
     , mPipeliningOverSSL(false)
     , mEnforceAssocReq(false)
     , mInPrivateBrowsingMode(PRIVATE_BROWSING_UNKNOWN)
     , mLastUniqueID(NowInSeconds())
     , mSessionStartTime(0)
@@ -1053,18 +1053,21 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
             mMaxPipelineObjectSize =
                 static_cast<PRInt64>(clamped(val, 1000, 100000000));
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("pipelining.read-timeout"))) {
         rv = prefs->GetIntPref(HTTP_PREF("pipelining.read-timeout"), &val);
         if (NS_SUCCEEDED(rv)) {
-            mPipelineReadTimeout =
-                PR_MillisecondsToInterval(clamped(val, 500, 0xffff));
+            if (!val)
+                mPipelineReadTimeout = 0;
+            else
+                mPipelineReadTimeout =
+                    PR_MillisecondsToInterval(clamped(val, 500, 0xffff));
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("pipelining.ssl"))) {
         rv = prefs->GetBoolPref(HTTP_PREF("pipelining.ssl"), &cVar);
         if (NS_SUCCEEDED(rv))
             mPipeliningOverSSL = cVar;
     }
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -167,17 +167,23 @@ nsHttpPipeline::SetPipelinePosition(PRIn
 }
 
 PRInt32
 nsHttpPipeline::PipelinePosition()
 {
     nsAHttpTransaction *trans = Response(0);
     if (trans)
         return trans->PipelinePosition();
-    return 2;
+
+    // The response queue is empty, so return oldest request
+    if (mRequestQ.Length())
+        return Request(mRequestQ.Length() - 1)->PipelinePosition();
+    
+    // No transactions in the pipeline
+    return 0;
 }
 
 nsHttpPipeline *
 nsHttpPipeline::QueryPipeline()
 {
     return this;
 }