зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1581637
- Part 10 - Implement a posibility to use alt-svc on transaction restart in some cases. r=mayhemer mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D46654 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a60ae4976f
Коммит
54678eb05c
|
@ -645,6 +645,9 @@ void Http3Session::ResetRecvd(uint64_t aStreamId, Http3AppError aError) {
|
|||
CloseStream(stream, NS_ERROR_NET_RESET);
|
||||
} else if (aError.tag == Http3AppError::Tag::RequestRejected) {
|
||||
// This request was rejected because server is probably busy or going away.
|
||||
// We can restart the request using alt-svc. Without calling
|
||||
// DoNotRemoveAltSvc the alt-svc route will be removed.
|
||||
stream->Transaction()->DoNotRemoveAltSvc();
|
||||
CloseStream(stream, NS_ERROR_NET_RESET);
|
||||
} else {
|
||||
if (stream->RecvdData()) {
|
||||
|
|
|
@ -183,6 +183,14 @@ class nsAHttpTransaction : public nsSupportsWeakReference {
|
|||
virtual void MakeNonSticky() {}
|
||||
virtual void ReuseConnectionOnRestartOK(bool) {}
|
||||
|
||||
// We call this function if we want to use alt-svc host again on the next
|
||||
// restart. If this function is not called on the next restart the
|
||||
// transaction will use the original route.
|
||||
// For example in case we receive a GOAWAY frame from a server, we can
|
||||
// restart and use the same alt-svc. If we get VersionFallback we do not
|
||||
// want to use the alt-svc on the restart.
|
||||
virtual void DoNotRemoveAltSvc() {}
|
||||
|
||||
// Returns true if early-data or fast open is possible.
|
||||
virtual MOZ_MUST_USE bool CanDo0RTT() { return false; }
|
||||
// Returns true if early-data is possible and transaction will remember
|
||||
|
|
|
@ -115,6 +115,7 @@ nsHttpTransaction::nsHttpTransaction()
|
|||
mContentDecodingCheck(false),
|
||||
mDeferredSendProgress(false),
|
||||
mWaitingOnPipeOut(false),
|
||||
mDoNotRemoveAltSvc(false),
|
||||
mReportedStart(false),
|
||||
mReportedResponseHeader(false),
|
||||
mResponseHeadTaken(false),
|
||||
|
@ -1293,7 +1294,7 @@ nsresult nsHttpTransaction::Restart() {
|
|||
// to the next
|
||||
mReuseOnRestart = false;
|
||||
|
||||
if (!mConnInfo->GetRoutedHost().IsEmpty()) {
|
||||
if (!mDoNotRemoveAltSvc && !mConnInfo->GetRoutedHost().IsEmpty()) {
|
||||
MutexAutoLock lock(*nsHttp::GetLock());
|
||||
RefPtr<nsHttpConnectionInfo> ci;
|
||||
mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
|
||||
|
@ -1305,6 +1306,9 @@ nsresult nsHttpTransaction::Restart() {
|
|||
}
|
||||
}
|
||||
|
||||
// Reset mDoNotRemoveAltSvc for the next try.
|
||||
mDoNotRemoveAltSvc = false;
|
||||
|
||||
return gHttpHandler->InitiateTransaction(this, mPriority);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,8 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
|
||||
void DisableSpdy() override;
|
||||
|
||||
void DoNotRemoveAltSvc() override { mDoNotRemoveAltSvc = true; }
|
||||
|
||||
nsHttpTransaction* QueryHttpTransaction() override { return this; }
|
||||
|
||||
already_AddRefed<Http2PushedStreamWrapper> GetPushedStream() {
|
||||
|
@ -380,6 +382,8 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
bool mDeferredSendProgress;
|
||||
bool mWaitingOnPipeOut;
|
||||
|
||||
bool mDoNotRemoveAltSvc;
|
||||
|
||||
// mClosed := transaction has been explicitly closed
|
||||
// mTransactionDone := transaction ran to completion or was interrupted
|
||||
// mResponseComplete := transaction ran to completion
|
||||
|
|
Загрузка…
Ссылка в новой задаче