Bug 958311 - Fix partial content load condition in nsHttpChannel, r=michal, a=bajaj
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 23 Jan 2014 22:43:17 +0100
changeset 167992 e9969e74c4a4ab6ee8f2dd997eea58069cae427f
parent 167991 cb5b46ea91f0ac56abd806197dd709186d52f2fb
child 167993 664bc0ef6421ce6cd56c5e3a4b5264ba027eb434
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, bajaj
bugs958311
milestone27.0
Bug 958311 - Fix partial content load condition in nsHttpChannel, r=michal, a=bajaj
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2001,17 +2001,17 @@ nsHttpChannel::EnsureAssocReq()
 
 //-----------------------------------------------------------------------------
 // nsHttpChannel <byte-range>
 //-----------------------------------------------------------------------------
 
 nsresult
 nsHttpChannel::MaybeSetupByteRangeRequest(int64_t partialLen, int64_t contentLength)
 {
-    nsresult rv = NS_OK;
+    nsresult rv = NS_ERROR_NOT_RESUMABLE;
 
     bool hasContentEncoding =
         mCachedResponseHead->PeekHeader(nsHttp::Content_Encoding)
         != nullptr;
 
     // Be pesimistic
     mIsPartialRequest = false;
 
@@ -2741,17 +2741,17 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
 
             mConcurentCacheAccess = 1;
         }
         else if (contentLength != int64_t(-1) && contentLength != size) {
             LOG(("Cached data size does not match the Content-Length header "
                  "[content-length=%lld size=%lld]\n", contentLength, size));
 
             rv = MaybeSetupByteRangeRequest(size, contentLength);
-            mCachedContentIsPartial = NS_SUCCEEDED(rv);
+            mCachedContentIsPartial = NS_SUCCEEDED(rv) && mIsPartialRequest;
             if (mCachedContentIsPartial) {
                 rv = OpenCacheInputStream(entry, false);
                 *aResult = ENTRY_NEEDS_REVALIDATION;
             }
             return rv;
         }
     }