Bug 1523427 - Check whether we really have a response for a upgrade request before making a connection DontReuse. r=michal

Differential Revision: https://phabricator.services.mozilla.com/D18202

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dragana Damjanovic 2019-01-31 15:09:01 +00:00
parent 1ad5d6e1f1
commit 4aa2cbebc3

View File

@ -1289,6 +1289,7 @@ nsresult nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans,
// it was successful. If so, we have to reset the transaction and step-up
// the socket connection if using SSL. Finally, we have to wake up the
// socket write request.
bool itWasProxyConnect = !!mProxyConnectStream;
if (mProxyConnectStream) {
MOZ_ASSERT(mUsingSpdyVersion == SpdyVersion::NONE,
"SPDY NPN Complete while using proxy connect stream");
@ -1347,8 +1348,8 @@ nsresult nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans,
// some proxies expect to see auth response on persistent connection.
// Also allow persistent conn for h2, as we don't want to waste connections
// for multiplexed upgrades.
if (hasUpgradeReq && responseStatus != 401 && responseStatus != 407 &&
!mSpdySession) {
if (!itWasProxyConnect && hasUpgradeReq && responseStatus != 401 &&
responseStatus != 407 && !mSpdySession) {
LOG(("HTTP Upgrade in play - disable keepalive for http/1.x\n"));
DontReuse();
}