# HG changeset patch # Parent 98f993e4ac0f44e51c30435f80e0facc0cc63fa4 # User Patrick McManus bug 528288 spdy - provide a pref to control alternate-protocol support r=honzab patch 8 diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -793,16 +793,17 @@ pref("network.http.connection-retry-time // IPv6 connectivity. pref("network.http.fast-fallback-to-IPv4", false); // Try and use SPDY when using SSL pref("network.http.spdy.enabled", false); 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); // default values for FTP // in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594, // Section 4.8 "High-Throughput Data Service Class", and 80 (0x50, or AF22) // per Section 4.7 "Low-Latency Data Service Class". pref("network.ftp.data.qos", 0); pref("network.ftp.control.qos", 0); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -475,16 +475,20 @@ nsHttpConnectionMgr::GetSpdyAlternatePro 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()); diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -196,16 +196,17 @@ nsHttpHandler::nsHttpHandler() , mUserAgentIsDirty(true) , mUseCache(true) , mPromptTempRedirect(true) , mSendSecureXSiteReferrer(true) , mEnablePersistentHttpsCaching(false) , mDoNotTrackEnabled(false) , mEnableSpdy(false) , mCoalesceSpdy(true) + , mUseAlternateProtocol(false) { #if defined(PR_LOGGING) gHttpLog = PR_NewLogModule("nsHttp"); #endif LOG(("Creating nsHttpHandler [this=%x].\n", this)); NS_ASSERTION(!gHttpHandler, "HTTP handler already created!"); @@ -1094,16 +1095,23 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc } if (PREF_CHANGED(HTTP_PREF("spdy.coalesce-hostnames"))) { rv = prefs->GetBoolPref(HTTP_PREF("spdy.coalesce-hostnames"), &cVar); if (NS_SUCCEEDED(rv)) 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.timeout"))) { rv = prefs->GetIntPref(HTTP_PREF("spdy.timeout"), &val); if (NS_SUCCEEDED(rv)) mSpdyTimeout = (PRUint16) clamped(val, 1, 0xffff); } // // INTL options diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -110,16 +110,17 @@ public: PRUint16 GetIdleSynTimeout() { return mIdleSynTimeout; } bool FastFallbackToIPv4() { return mFastFallbackToIPv4; } PRUint32 MaxSocketCount(); bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } bool IsSpdyEnabled() { return mEnableSpdy; } bool CoalesceSpdy() { return mCoalesceSpdy; } + bool UseAlternateProtocol() { return mUseAlternateProtocol; } bool PromptTempRedirect() { return mPromptTempRedirect; } nsHttpAuthCache *AuthCache() { return &mAuthCache; } nsHttpConnectionMgr *ConnMgr() { return mConnMgr; } // cache support nsresult GetCacheSession(nsCacheStoragePolicy, nsICacheSession **); @@ -332,19 +333,20 @@ private: bool mSendSecureXSiteReferrer; // Persistent HTTPS caching flag bool mEnablePersistentHttpsCaching; // For broadcasting the preference to not be tracked bool mDoNotTrackEnabled; - // Try to use SPDY instead of HTTP/1.1 over SSL + // Try to use SPDY features instead of HTTP/1.1 over SSL bool mEnableSpdy; bool mCoalesceSpdy; + bool mUseAlternateProtocol; }; //----------------------------------------------------------------------------- extern nsHttpHandler *gHttpHandler; //----------------------------------------------------------------------------- // nsHttpsHandler - thin wrapper to distinguish the HTTP handler from the