diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp index dba5dafdd..23e68c218 100644 --- a/netwerk/base/nsBaseChannel.cpp +++ b/netwerk/base/nsBaseChannel.cpp @@ -55,6 +55,7 @@ nsBaseChannel::nsBaseChannel() , mSynthProgressEvents(false) , mAllowThreadRetargeting(true) , mWaitingOnAsyncRedirect(false) + , mOpenRedirectChannel(false) , mStatus(NS_OK) , mContentDispositionHint(UINT32_MAX) , mContentLength(-1) diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 8c07487a0..fcf3165e0 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -2374,10 +2374,6 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, return *countRead ? NS_OK : NS_BASE_STREAM_WOULD_BLOCK; } - if (!m0RTTStreams.Contains(stream->StreamID())) { - m0RTTStreams.AppendElement(stream->StreamID()); - } - // Need to adjust this to only take as much as we can fit in with the // preamble/settings/priority stuff count -= (mOutputQueueUsed - mOutputQueueSent); @@ -2400,6 +2396,12 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, *countRead += earlyDataUsed; } + if (mAttemptingEarlyData && !m0RTTStreams.Contains(stream->StreamID())) { + LOG3(("Http2Session::ReadSegmentsAgain adding stream %d to m0RTTStreams\n", + stream->StreamID())); + m0RTTStreams.AppendElement(stream->StreamID()); + } + // Not every permutation of stream->ReadSegents produces data (and therefore // tries to flush the output queue) - SENDING_FIN_STREAM can be an example // of that. But we might still have old data buffered that would be good @@ -2820,7 +2822,9 @@ Http2Session::WriteSegmentsAgain(nsAHttpSegmentWriter *writer, "stream->writeSegments returning code %x\n", this, streamID, mNeedsCleanup, rv)); MOZ_ASSERT(!mNeedsCleanup || mNeedsCleanup->StreamID() == streamID); - CleanupStream(streamID, NS_OK, CANCEL_ERROR); + CleanupStream(streamID, + (rv == NS_BINDING_RETARGETED) ? NS_BINDING_RETARGETED : NS_OK, + CANCEL_ERROR); mNeedsCleanup = nullptr; *again = false; ResumeRecv(); diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index aa11b5ccc..fb99bd277 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -1496,8 +1496,8 @@ bool Http2Stream::Do0RTT() { MOZ_ASSERT(mTransaction); - mAttempting0RTT = true; - return mTransaction->Do0RTT(); + mAttempting0RTT = mTransaction->Do0RTT(); + return mAttempting0RTT; } nsresult diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 3581b8147..5a7344340 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -36,6 +36,8 @@ #include "nsITransport.h" #include "nsIOService.h" #include "nsISchedulingContext.h" +#include "NSSErrorsService.h" +#include "sslerr.h" #include #include "mozilla-config.h" @@ -999,8 +1001,7 @@ nsHttpTransaction::Close(nsresult reason) // sent any data. for this reason, mSendData == FALSE does not imply // mReceivedData == FALSE. (see bug 203057 for more info.) // - if (reason == NS_ERROR_NET_RESET || reason == NS_OK) { - + if (reason == NS_ERROR_NET_RESET || reason == NS_OK || reason == psm::GetXPCOMFromNSSError(SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA)) { if (mForceRestart && NS_SUCCEEDED(Restart())) { if (mResponseHead) { mResponseHead->Reset(); @@ -1027,8 +1028,10 @@ nsHttpTransaction::Close(nsresult reason) bool reallySentData = mSentData && (!mConnection || mConnection->BytesWritten()); - if (!mReceivedData && - (!reallySentData || connReused || mPipelinePosition)) { + if (reason == psm::GetXPCOMFromNSSError(SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA) || + (!mReceivedData && + ((mRequestHead && mRequestHead->IsSafeMethod()) || + !reallySentData || connReused))) { // if restarting fails, then we must proceed to close the pipe, // which will notify the channel that the transaction failed.