From a4cc5f503cfa7b499678ca067194fce2e644e917 Mon Sep 17 00:00:00 2001 From: Dragana Damjanovic Date: Tue, 29 Oct 2019 23:28:40 +0000 Subject: [PATCH] Bug 1581599 - Http2 response without content-length can be considered stronly framed. r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D48463 --HG-- extra : moz-landing-system : lando --- netwerk/protocol/http/nsHttpTransaction.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 8a2a7f031c2f..4467e3a2101d 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -1035,8 +1035,10 @@ void nsHttpTransaction::Close(nsresult reason) { // we must no longer reference the connection! find out if the // connection was being reused before letting it go. bool connReused = false; + bool isHttp2 = false; if (mConnection) { connReused = mConnection->IsReused(); + isHttp2 = mConnection->Version() >= HttpVersion::v2_0; } mConnected = false; mTunnelProvider = nullptr; @@ -1112,6 +1114,12 @@ void nsHttpTransaction::Close(nsresult reason) { } } + if (!mResponseIsComplete && NS_SUCCEEDED(reason) && isHttp2) { + // Responses without content-length header field are still complete if + // they are transfered over http2 and the stream is properly closed. + mResponseIsComplete = true; + } + if ((mChunkedDecoder || (mContentLength >= int64_t(0))) && (NS_SUCCEEDED(reason) && !mResponseIsComplete)) { NS_WARNING("Partial transfer, incomplete HTTP response received");