mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 878594 - remove alternate-protocol support for spdy upgrades r=mcmanus
This commit is contained in:
parent
ddf4e22e32
commit
276d70ed10
@ -1015,7 +1015,6 @@ pref("network.http.spdy.enabled.v3", true);
|
||||
pref("network.http.spdy.chunk-size", 4096);
|
||||
pref("network.http.spdy.timeout", 180);
|
||||
pref("network.http.spdy.coalesce-hostnames", true);
|
||||
pref("network.http.spdy.use-alternate-protocol", true);
|
||||
pref("network.http.spdy.persistent-settings", false);
|
||||
pref("network.http.spdy.ping-threshold", 58);
|
||||
pref("network.http.spdy.ping-timeout", 8);
|
||||
|
@ -46,11 +46,9 @@ SpdyInformation::SpdyInformation()
|
||||
// list the preferred version first
|
||||
Version[0] = SPDY_VERSION_3;
|
||||
VersionString[0] = NS_LITERAL_CSTRING("spdy/3");
|
||||
AlternateProtocolString[0] = NS_LITERAL_CSTRING("443:npn-spdy/3");
|
||||
|
||||
Version[1] = SPDY_VERSION_2;
|
||||
VersionString[1] = NS_LITERAL_CSTRING("spdy/2");
|
||||
AlternateProtocolString[1] = NS_LITERAL_CSTRING("443:npn-spdy/2");
|
||||
}
|
||||
|
||||
bool
|
||||
@ -83,27 +81,6 @@ SpdyInformation::GetNPNVersionIndex(const nsACString &npnString,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SpdyInformation::GetAlternateProtocolVersionIndex(const char *val,
|
||||
uint8_t *result)
|
||||
{
|
||||
if (!val || !val[0])
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (ProtocolEnabled(0) && nsHttp::FindToken(val,
|
||||
AlternateProtocolString[0].get(),
|
||||
HTTP_HEADER_VALUE_SEPS))
|
||||
*result = Version[0];
|
||||
else if (ProtocolEnabled(1) && nsHttp::FindToken(val,
|
||||
AlternateProtocolString[1].get(),
|
||||
HTTP_HEADER_VALUE_SEPS))
|
||||
*result = Version[1];
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla::net
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -67,11 +67,6 @@ public:
|
||||
// string was known.
|
||||
nsresult GetNPNVersionIndex(const nsACString &npnString, uint8_t *result);
|
||||
|
||||
// lookup a version enum based on an alternate protocol string. returns NS_OK
|
||||
// if string was known and corresponding protocol is enabled.
|
||||
nsresult GetAlternateProtocolVersionIndex(const char *val,
|
||||
uint8_t *result);
|
||||
|
||||
enum {
|
||||
SPDY_VERSION_2 = 2,
|
||||
SPDY_VERSION_3 = 3
|
||||
@ -79,7 +74,6 @@ public:
|
||||
|
||||
uint8_t Version[2];
|
||||
nsCString VersionString[2];
|
||||
nsCString AlternateProtocolString[2];
|
||||
};
|
||||
|
||||
}} // namespace mozilla::net
|
||||
|
@ -23,7 +23,6 @@ HTTP_ATOM(Accept_Language, "Accept-Language")
|
||||
HTTP_ATOM(Accept_Ranges, "Accept-Ranges")
|
||||
HTTP_ATOM(Age, "Age")
|
||||
HTTP_ATOM(Allow, "Allow")
|
||||
HTTP_ATOM(Alternate_Protocol, "Alternate-Protocol")
|
||||
HTTP_ATOM(Assoc_Req, "Assoc-Req")
|
||||
HTTP_ATOM(Authentication, "Authentication")
|
||||
HTTP_ATOM(Authorization, "Authorization")
|
||||
|
@ -380,18 +380,6 @@ nsHttpChannel::Connect()
|
||||
LOG(("nsHttpChannel::Connect() STS permissions found\n"));
|
||||
return AsyncCall(&nsHttpChannel::HandleAsyncRedirectChannelToHttps);
|
||||
}
|
||||
|
||||
// Check for a previous SPDY Alternate-Protocol directive
|
||||
if (gHttpHandler->IsSpdyEnabled() && mAllowSpdy) {
|
||||
nsAutoCString hostPort;
|
||||
|
||||
if (NS_SUCCEEDED(mURI->GetHostPort(hostPort)) &&
|
||||
gHttpHandler->ConnMgr()->GetSpdyAlternateProtocol(hostPort)) {
|
||||
LOG(("nsHttpChannel::Connect() Alternate-Protocol found\n"));
|
||||
return AsyncCall(
|
||||
&nsHttpChannel::HandleAsyncRedirectChannelToHttps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that we are using a valid hostname
|
||||
@ -4884,16 +4872,6 @@ nsHttpChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
mSecurityInfo = mTransaction->SecurityInfo();
|
||||
}
|
||||
|
||||
if (!mCachePump && NS_FAILED(mStatus) &&
|
||||
(mLoadFlags & LOAD_REPLACE) && mOriginalURI && mAllowSpdy) {
|
||||
// For sanity's sake we may want to cancel an alternate protocol
|
||||
// redirection involving the original host name
|
||||
|
||||
nsAutoCString hostPort;
|
||||
if (NS_SUCCEEDED(mOriginalURI->GetHostPort(hostPort)))
|
||||
gHttpHandler->ConnMgr()->RemoveSpdyAlternateProtocol(hostPort);
|
||||
}
|
||||
|
||||
// don't enter this block if we're reading from the cache...
|
||||
if (NS_SUCCEEDED(mStatus) && !mCachePump && mTransaction) {
|
||||
// mTransactionPump doesn't hit OnInputStreamReady and call this until
|
||||
|
@ -409,36 +409,6 @@ nsHttpConnection::SetupNPN(uint32_t caps)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpConnection::HandleAlternateProtocol(nsHttpResponseHead *responseHead)
|
||||
{
|
||||
// Look for the Alternate-Protocol header. Alternate-Protocol is
|
||||
// essentially a way to rediect future transactions from http to
|
||||
// spdy.
|
||||
//
|
||||
|
||||
if (!gHttpHandler->IsSpdyEnabled() || mUsingSpdyVersion)
|
||||
return;
|
||||
|
||||
const char *val = responseHead->PeekHeader(nsHttp::Alternate_Protocol);
|
||||
if (!val)
|
||||
return;
|
||||
|
||||
// The spec allows redirections to any port, but due to concerns over
|
||||
// silently redirecting to stealth ports we only allow port 443
|
||||
//
|
||||
// Alternate-Protocol: 5678:somethingelse, 443:npn-spdy/2
|
||||
|
||||
uint8_t alternateProtocolVersion;
|
||||
if (NS_SUCCEEDED(gHttpHandler->SpdyInfo()->
|
||||
GetAlternateProtocolVersionIndex(val,
|
||||
&alternateProtocolVersion))) {
|
||||
LOG(("Connection %p Transaction %p found Alternate-Protocol "
|
||||
"header %s", this, mTransaction.get(), val));
|
||||
gHttpHandler->ConnMgr()->ReportSpdyAlternateProtocol(this);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHttpConnection::AddTransaction(nsAHttpTransaction *httpTransaction,
|
||||
int32_t priority)
|
||||
@ -844,9 +814,6 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans,
|
||||
if (!foundKeepAliveMax && mRemainingConnectionUses && !mUsingSpdyVersion)
|
||||
--mRemainingConnectionUses;
|
||||
|
||||
if (!mProxyConnectStream)
|
||||
HandleAlternateProtocol(responseHead);
|
||||
|
||||
// If we're doing a proxy connect, we need to check whether or not
|
||||
// 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
|
||||
|
@ -177,10 +177,6 @@ private:
|
||||
bool EnsureNPNComplete();
|
||||
void SetupNPN(uint32_t caps);
|
||||
|
||||
// Inform the connection manager of any SPDY Alternate-Protocol
|
||||
// redirections
|
||||
void HandleAlternateProtocol(nsHttpResponseHead *);
|
||||
|
||||
// Start the Spdy transaction handler when NPN indicates spdy/*
|
||||
void StartSpdy(uint8_t versionLevel);
|
||||
|
||||
|
@ -70,7 +70,6 @@ nsHttpConnectionMgr::nsHttpConnectionMgr()
|
||||
{
|
||||
LOG(("Creating nsHttpConnectionMgr @%x\n", this));
|
||||
mCT.Init();
|
||||
mAlternateProtocolHash.Init(16);
|
||||
mSpdyPreferredHash.Init();
|
||||
}
|
||||
|
||||
@ -638,72 +637,6 @@ nsHttpConnectionMgr::GetSpdyCWNDSetting(nsHttpConnectionInfo *ci)
|
||||
return ent->mSpdyCWND;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHttpConnectionMgr::GetSpdyAlternateProtocol(nsACString &hostPortKey)
|
||||
{
|
||||
if (!gHttpHandler->UseAlternateProtocol())
|
||||
return false;
|
||||
|
||||
// The Alternate Protocol hash is protected under the monitor because
|
||||
// it is read from both the main and the network thread.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
return mAlternateProtocolHash.Contains(hostPortKey);
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpConnectionMgr::ReportSpdyAlternateProtocol(nsHttpConnection *conn)
|
||||
{
|
||||
// Check network.http.spdy.use-alternate-protocol pref
|
||||
if (!gHttpHandler->UseAlternateProtocol())
|
||||
return;
|
||||
|
||||
// For now lets not bypass proxies due to the alternate-protocol header
|
||||
if (conn->ConnectionInfo()->UsingHttpProxy())
|
||||
return;
|
||||
|
||||
nsCString hostPortKey(conn->ConnectionInfo()->Host());
|
||||
if (conn->ConnectionInfo()->Port() != 80) {
|
||||
hostPortKey.Append(NS_LITERAL_CSTRING(":"));
|
||||
hostPortKey.AppendInt(conn->ConnectionInfo()->Port());
|
||||
}
|
||||
|
||||
// The Alternate Protocol hash is protected under the monitor because
|
||||
// it is read from both the main and the network thread.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// Check to see if this is already present
|
||||
if (mAlternateProtocolHash.Contains(hostPortKey))
|
||||
return;
|
||||
|
||||
if (mAlternateProtocolHash.Count() > 2000)
|
||||
mAlternateProtocolHash.EnumerateEntries(&TrimAlternateProtocolHash,
|
||||
this);
|
||||
|
||||
mAlternateProtocolHash.PutEntry(hostPortKey);
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpConnectionMgr::RemoveSpdyAlternateProtocol(nsACString &hostPortKey)
|
||||
{
|
||||
// The Alternate Protocol hash is protected under the monitor because
|
||||
// it is read from both the main and the network thread.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
return mAlternateProtocolHash.RemoveEntry(hostPortKey);
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::TrimAlternateProtocolHash(nsCStringHashKey *entry,
|
||||
void *closure)
|
||||
{
|
||||
nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
|
||||
|
||||
if (self->mAlternateProtocolHash.Count() > 2000)
|
||||
return PL_DHASH_REMOVE;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
nsHttpConnectionMgr::nsConnectionEntry *
|
||||
nsHttpConnectionMgr::GetSpdyPreferredEnt(nsConnectionEntry *aOriginalEntry)
|
||||
{
|
||||
|
@ -135,11 +135,6 @@ public:
|
||||
// to the socket thread
|
||||
nsresult UpdateRequestTokenBucket(mozilla::net::EventTokenBucket *aBucket);
|
||||
|
||||
// Lookup/Cancel HTTP->SPDY redirections
|
||||
bool GetSpdyAlternateProtocol(nsACString &key);
|
||||
void ReportSpdyAlternateProtocol(nsHttpConnection *);
|
||||
void RemoveSpdyAlternateProtocol(nsACString &key);
|
||||
|
||||
// Pipielining Interfaces and Datatypes
|
||||
|
||||
const static uint32_t kPipelineInfoTypeMask = 0xffff0000;
|
||||
@ -651,12 +646,6 @@ private:
|
||||
//
|
||||
nsClassHashtable<nsCStringHashKey, nsConnectionEntry> mCT;
|
||||
|
||||
// mAlternateProtocolHash is used only for spdy/* upgrades for now
|
||||
// protected by the monitor
|
||||
nsTHashtable<nsCStringHashKey> mAlternateProtocolHash;
|
||||
static PLDHashOperator TrimAlternateProtocolHash(nsCStringHashKey *entry,
|
||||
void *closure);
|
||||
|
||||
static PLDHashOperator ReadConnectionEntry(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
void *aArg);
|
||||
|
@ -181,7 +181,6 @@ nsHttpHandler::nsHttpHandler()
|
||||
, mSpdyV2(true)
|
||||
, mSpdyV3(true)
|
||||
, mCoalesceSpdy(true)
|
||||
, mUseAlternateProtocol(false)
|
||||
, mSpdyPersistentSettings(false)
|
||||
, mAllowSpdyPush(true)
|
||||
, mSpdySendingChunkSize(ASpdySession::kSendingChunkSize)
|
||||
@ -1117,13 +1116,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
mCoalesceSpdy = cVar;
|
||||
}
|
||||
|
||||
if (PREF_CHANGED(HTTP_PREF("spdy.use-alternate-protocol"))) {
|
||||
rv = prefs->GetBoolPref(HTTP_PREF("spdy.use-alternate-protocol"),
|
||||
&cVar);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mUseAlternateProtocol = cVar;
|
||||
}
|
||||
|
||||
if (PREF_CHANGED(HTTP_PREF("spdy.persistent-settings"))) {
|
||||
rv = prefs->GetBoolPref(HTTP_PREF("spdy.persistent-settings"),
|
||||
&cVar);
|
||||
|
@ -97,7 +97,6 @@ public:
|
||||
bool IsSpdyV2Enabled() { return mSpdyV2; }
|
||||
bool IsSpdyV3Enabled() { return mSpdyV3; }
|
||||
bool CoalesceSpdy() { return mCoalesceSpdy; }
|
||||
bool UseAlternateProtocol() { return mUseAlternateProtocol; }
|
||||
bool UseSpdyPersistentSettings() { return mSpdyPersistentSettings; }
|
||||
uint32_t SpdySendingChunkSize() { return mSpdySendingChunkSize; }
|
||||
uint32_t SpdySendBufferSize() { return mSpdySendBufferSize; }
|
||||
@ -416,7 +415,6 @@ private:
|
||||
bool mSpdyV2;
|
||||
bool mSpdyV3;
|
||||
bool mCoalesceSpdy;
|
||||
bool mUseAlternateProtocol;
|
||||
bool mSpdyPersistentSettings;
|
||||
bool mAllowSpdyPush;
|
||||
uint32_t mSpdySendingChunkSize;
|
||||
|
Loading…
Reference in New Issue
Block a user