From bb9e155841de0e0fce81183a2fe6471f5c4df288 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 11 Feb 2018 07:48:28 +0100 Subject: Bug 1322373 - TLS 1.3 early-data for http/2 --- netwerk/protocol/http/Http2Stream.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'netwerk/protocol/http/Http2Stream.cpp') diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index 5c562557c..f49c1f138 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -70,6 +70,7 @@ Http2Stream::Http2Stream(nsAHttpTransaction *httpTransaction, , mTotalSent(0) , mTotalRead(0) , mPushSource(nullptr) + , mAttempting0RTT(false) , mIsTunnel(false) , mPlainTextTunnel(false) { @@ -925,7 +926,9 @@ Http2Stream::TransmitFrame(const char *buf, *countUsed += mTxStreamFrameSize; } - mSession->FlushOutputQueue(); + if (!mAttempting0RTT) { + mSession->FlushOutputQueue(); + } // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0 UpdateTransportSendEvents(mTxInlineFrameUsed + mTxStreamFrameSize); @@ -1468,5 +1471,26 @@ Http2Stream::MapStreamToHttpConnection() mTransaction->ConnectionInfo()); } +// ----------------------------------------------------------------------------- +// mirror nsAHttpTransaction +// ----------------------------------------------------------------------------- + +bool +Http2Stream::Do0RTT() +{ + MOZ_ASSERT(mTransaction); + mAttempting0RTT = true; + return mTransaction->Do0RTT(); +} + +nsresult +Http2Stream::Finish0RTT(bool aRestart, bool aAlpnChanged) +{ + MOZ_ASSERT(mTransaction); + mAttempting0RTT = false; + return mTransaction->Finish0RTT(aRestart, aAlpnChanged); +} + + } // namespace net } // namespace mozilla -- cgit v1.2.3 From 756fb3e1455cd903f952ded1c45f86e3527875ed Mon Sep 17 00:00:00 2001 From: Nicholas Hurley Date: Fri, 2 Feb 2018 11:03:08 -0800 Subject: Bug 1416529. r=mcmanus, a=ritu MozReview-Commit-ID: CD1l5vLB4yy --HG-- extra : rebase_source : d74f8ca96dab4e0d25d79948fcddbf8dab98bb36 --- netwerk/protocol/http/Http2Stream.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'netwerk/protocol/http/Http2Stream.cpp') diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index f49c1f138..7a8f96855 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -103,10 +103,20 @@ Http2Stream::Http2Stream(nsAHttpTransaction *httpTransaction, Http2Stream::~Http2Stream() { + ClearPushSource(); ClearTransactionsBlockedOnTunnel(); mStreamID = Http2Session::kDeadStreamID; } +void +Http2Stream::ClearPushSource() +{ + if (mPushSource) { + mPushSource->SetConsumerStream(nullptr); + mPushSource = nullptr; + } +} + // ReadSegments() is used to write data down the socket. Generally, HTTP // request data is pulled from the approriate transaction and // converted to HTTP/2 data. Sometimes control data like a window-update is @@ -1083,6 +1093,10 @@ Http2Stream::ConvertPushHeaders(Http2Decompressor *decompressor, void Http2Stream::Close(nsresult reason) { + // In case we are connected to a push, make sure the push knows we are closed, + // so it doesn't try to give us any more DATA that comes on it after our close. + ClearPushSource(); + mTransaction->Close(reason); } -- cgit v1.2.3