Bug 1346392 - force non-spdy on sticky auth connections. r=dragana

MozReview-Commit-ID: IkYTVgetKsn

--HG--
extra : rebase_source : 18a903dec51e152688e045eeb410541b219a6189
This commit is contained in:
Nicholas Hurley 2017-03-28 17:15:23 -07:00
Родитель a9e45312b0
Коммит 717c8bdd83
6 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -5654,6 +5654,25 @@ NS_IMETHODIMP nsHttpChannel::CloseStickyConnection()
return NS_OK;
}
NS_IMETHODIMP nsHttpChannel::ForceNoSpdy()
{
LOG(("nsHttpChannel::ForceNoSpdy this=%p", this));
MOZ_ASSERT(mTransaction);
if (!mTransaction) {
return NS_ERROR_UNEXPECTED;
}
mAllowSpdy = 0;
mCaps |= NS_HTTP_DISALLOW_SPDY;
if (!(mTransaction->Caps() & NS_HTTP_DISALLOW_SPDY)) {
mTransaction->DisableSpdy();
}
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsHttpChannel::nsISupports
//-----------------------------------------------------------------------------

Просмотреть файл

@ -117,6 +117,7 @@ public:
NS_IMETHOD OnAuthAvailable() override;
NS_IMETHOD OnAuthCancelled(bool userCancel) override;
NS_IMETHOD CloseStickyConnection() override;
NS_IMETHOD ForceNoSpdy() override;
// Functions we implement from nsIHttpAuthenticableChannel but are
// declared in HttpBaseChannel must be implemented in this class. We
// just call the HttpBaseChannel:: impls.

Просмотреть файл

@ -819,6 +819,10 @@ nsHttpChannelAuthProvider::GetCredentialsForChallenge(const char *challenge,
}
mConnectionBased = !!(authFlags & nsIHttpAuthenticator::CONNECTION_BASED);
if (mConnectionBased) {
rv = mAuthChannel->ForceNoSpdy();
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
if (identityInvalid) {
if (entry) {

Просмотреть файл

@ -1848,6 +1848,11 @@ nsHttpTransaction::CheckForStickyAuthScheme()
MOZ_ASSERT(mResponseHead);
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (mClosed) {
LOG((" closed, not checking"));
return;
}
CheckForStickyAuthSchemeAt(nsHttp::WWW_Authenticate);
CheckForStickyAuthSchemeAt(nsHttp::Proxy_Authenticate);
}

Просмотреть файл

@ -135,6 +135,8 @@ public:
void DispatchedAsBlocking();
void RemoveDispatchedAsBlocking();
void DisableSpdy() override;
nsHttpTransaction *QueryHttpTransaction() override { return this; }
Http2PushedStream *GetPushedStream() { return mPushedStream; }
@ -209,7 +211,6 @@ private:
bool ResponseTimeoutEnabled() const final;
void DisableSpdy() override;
void ReuseConnectionOnRestartOK(bool reuseOk) override { mReuseOnRestart = reuseOk; }
// Called right after we parsed the response head. Checks for connection based

Просмотреть файл

@ -112,4 +112,10 @@ interface nsIHttpAuthenticableChannel : nsIProxiedChannel
* the same connection.
*/
[must_use] void closeStickyConnection();
/**
* Tells the channel to not use SPDY-like protocols, since this will be
* using connection-oriented auth.
*/
[must_use] void forceNoSpdy();
};