Skip to content

Commit

Permalink
Bug 1687320 - Avoid doing 0RTT again if the transaction will be resta…
Browse files Browse the repository at this point in the history
…rted r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D103479
  • Loading branch information
KershawChang committed Feb 3, 2021
1 parent f5e3af8 commit 4e494b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 0 additions & 2 deletions netwerk/protocol/http/nsAHttpTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ class nsAHttpTransaction : public nsSupportsWeakReference {
// want to use the alt-svc on the restart.
virtual void DoNotRemoveAltSvc() {}

// Returns true if early-data or fast open is possible.
[[nodiscard]] virtual bool CanDo0RTT() { return false; }
// Returns true if early-data is possible and transaction will remember
// that it is in 0RTT mode (to know should it rewide transaction or not
// in the case of an error).
Expand Down
11 changes: 3 additions & 8 deletions netwerk/protocol/http/nsHttpTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2863,14 +2863,6 @@ void nsHttpTransaction::GetNetworkAddresses(NetAddr& self, NetAddr& peer,
aEchConfigUsed = mEchConfigUsed;
}

bool nsHttpTransaction::CanDo0RTT() {
if (mRequestHead->IsSafeMethod() && !mDoNotTryEarlyData &&
(!mConnection || !mConnection->IsProxyConnectInProgress())) {
return true;
}
return false;
}

bool nsHttpTransaction::Do0RTT() {
if (mRequestHead->IsSafeMethod() && !mDoNotTryEarlyData &&
(!mConnection || !mConnection->IsProxyConnectInProgress())) {
Expand All @@ -2894,6 +2886,9 @@ nsresult nsHttpTransaction::Finish0RTT(bool aRestart,
mEarlyDataDisposition = EARLY_ACCEPTED;
}
if (aRestart) {
// Not to use 0RTT when this transaction is restarted next time.
mDoNotTryEarlyData = true;

// Reset request headers to be sent again.
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
if (seekable) {
Expand Down
1 change: 0 additions & 1 deletion netwerk/protocol/http/nsHttpTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ class nsHttpTransaction final : public nsAHttpTransaction,
// restart - this indicates that state for dev tools
void Refused0RTT();

[[nodiscard]] bool CanDo0RTT() override;
[[nodiscard]] nsresult RestartOnFastOpenError() override;

uint64_t TopLevelOuterContentWindowId() override {
Expand Down

0 comments on commit 4e494b4

Please sign in to comment.