diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 42dd829dc73d..c652189a0e16 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -2769,6 +2769,9 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, this, stream, stream->StreamID())); FlushOutputQueue(); SetWriteCallbacks(); + if (!mCannotDo0RTTStreams.Contains(stream)) { + mCannotDo0RTTStreams.AppendElement(stream); + } // We can still send our preamble *countRead = mOutputQueueUsed - mOutputQueueSent; return *countRead ? NS_OK : NS_BASE_STREAM_WOULD_BLOCK; @@ -3393,15 +3396,27 @@ Http2Session::Finish0RTT(bool aRestart, bool aAlpnChanged) // This is the easy case - early data failed, but we're speaking h2, so // we just need to rewind to the beginning of the preamble and try again. mOutputQueueSent = 0; + + for (size_t i = 0; i < mCannotDo0RTTStreams.Length(); ++i) { + if (mCannotDo0RTTStreams[i] && VerifyStream(mCannotDo0RTTStreams[i])) { + TransactionHasDataToWrite(mCannotDo0RTTStreams[i]); + } + } } } else { // 0RTT succeeded + for (size_t i = 0; i < mCannotDo0RTTStreams.Length(); ++i) { + if (mCannotDo0RTTStreams[i] && VerifyStream(mCannotDo0RTTStreams[i])) { + TransactionHasDataToWrite(mCannotDo0RTTStreams[i]); + } + } // Make sure we look for any incoming data in repsonse to our early data. Unused << ResumeRecv(); } mAttemptingEarlyData = false; m0RTTStreams.Clear(); + mCannotDo0RTTStreams.Clear(); RealignOutputQueue(); return NS_OK; diff --git a/netwerk/protocol/http/Http2Session.h b/netwerk/protocol/http/Http2Session.h index 87c4e8b9fcb9..4fdc175ab166 100644 --- a/netwerk/protocol/http/Http2Session.h +++ b/netwerk/protocol/http/Http2Session.h @@ -529,6 +529,9 @@ private: bool mAttemptingEarlyData; // The ID(s) of the stream(s) that we are getting 0RTT data from. nsTArray> m0RTTStreams; + // The ID(s) of the stream(s) that are not able to send 0RTT data. We need to + // remember them put them into mReadyForWrite queue when 0RTT finishes. + nsTArray> mCannotDo0RTTStreams; bool RealJoinConnection(const nsACString &hostname, int32_t port, bool jk); bool TestOriginFrame(const nsACString &name, int32_t port);