#632: M1424915 M1354233 M1324114 M1343008 M1236277(just backbugs) M1328955

This commit is contained in:
Cameron Kaiser 2020-11-20 19:52:26 -08:00
parent 29dcb592a6
commit d87db7e160
4 changed files with 19 additions and 11 deletions

View File

@ -55,6 +55,7 @@ nsBaseChannel::nsBaseChannel()
, mSynthProgressEvents(false)
, mAllowThreadRetargeting(true)
, mWaitingOnAsyncRedirect(false)
, mOpenRedirectChannel(false)
, mStatus(NS_OK)
, mContentDispositionHint(UINT32_MAX)
, mContentLength(-1)

View File

@ -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();

View File

@ -1496,8 +1496,8 @@ bool
Http2Stream::Do0RTT()
{
MOZ_ASSERT(mTransaction);
mAttempting0RTT = true;
return mTransaction->Do0RTT();
mAttempting0RTT = mTransaction->Do0RTT();
return mAttempting0RTT;
}
nsresult

View File

@ -36,6 +36,8 @@
#include "nsITransport.h"
#include "nsIOService.h"
#include "nsISchedulingContext.h"
#include "NSSErrorsService.h"
#include "sslerr.h"
#include <algorithm>
#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.