diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp index f573c3caaac..c4422a65ad4 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -173,7 +173,7 @@ nsHttpChannel::Init(nsIURI *uri, NS_ADDREF(mConnectionInfo); // make sure our load flags include this bit if this is a secure channel. - if (usingSSL) + if (usingSSL && !gHttpHandler->IsPersistentHttpsCachingEnabled()) mLoadFlags |= INHIBIT_PERSISTENT_CACHING; // Set default request method @@ -2512,7 +2512,8 @@ nsHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags) mLoadFlags = aLoadFlags; // don't let anyone overwrite this bit if we're using a secure channel. - if (mConnectionInfo && mConnectionInfo->UsingSSL()) + if (mConnectionInfo && mConnectionInfo->UsingSSL() + && !gHttpHandler->IsPersistentHttpsCachingEnabled()) mLoadFlags |= INHIBIT_PERSISTENT_CACHING; return NS_OK; diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp index f433d1b826e..a8275a0ab47 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp @@ -87,9 +87,11 @@ static NS_DEFINE_CID(kSocketProviderServiceCID, NS_SOCKETPROVIDERSERVICE_CID); #define INTL_ACCEPT_LANGUAGES "intl.accept_languages" #define INTL_ACCEPT_CHARSET "intl.charset.default" #define NETWORK_ENABLEIDN "network.enableIDN" +#define BROWSER_PREF_PREFIX "browser.cache." #define UA_PREF(_pref) UA_PREF_PREFIX _pref #define HTTP_PREF(_pref) HTTP_PREF_PREFIX _pref +#define BROWSER_PREF(_pref) BROWSER_PREF_PREFIX _pref //----------------------------------------------------------------------------- @@ -143,6 +145,7 @@ nsHttpHandler::nsHttpHandler() , mUserAgentIsDirty(PR_TRUE) , mUseCache(PR_TRUE) , mSendSecureXSiteReferrer(PR_TRUE) + , mEnablePersistentHttpsCaching(PR_FALSE) { #if defined(PR_LOGGING) gHttpLog = PR_NewLogModule("nsHttp"); @@ -198,6 +201,7 @@ nsHttpHandler::Init() pbi->AddObserver(INTL_ACCEPT_LANGUAGES, this, PR_TRUE); pbi->AddObserver(INTL_ACCEPT_CHARSET, this, PR_TRUE); pbi->AddObserver(NETWORK_ENABLEIDN, this, PR_TRUE); + pbi->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, PR_TRUE); } PrefsChanged(prefBranch, nsnull); } @@ -979,6 +983,14 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref) } } + // enable Persistent caching for HTTPS - bug#205921 + if (PREF_CHANGED(BROWSER_PREF("disk_cache_ssl"))) { + cVar = PR_FALSE; + rv = prefs->GetBoolPref(BROWSER_PREF("disk_cache_ssl"), &cVar); + if (NS_SUCCEEDED(rv)) + mEnablePersistentHttpsCaching = cVar; + } + // // INTL options // diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.h b/mozilla/netwerk/protocol/http/src/nsHttpHandler.h index a183f18bff5..12f64205631 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.h @@ -92,6 +92,8 @@ public: PRUint16 MaxRequestAttempts() { return mMaxRequestAttempts; } const char *DefaultSocketType() { return mDefaultSocketType.get(); /* ok to return null */ } nsIIDNService *IDNConverter() { return mIDNConverter; } + + PRBool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } nsHttpAuthCache *AuthCache() { return &mAuthCache; } nsHttpConnectionMgr *ConnMgr() { return mConnMgr; } @@ -254,6 +256,9 @@ private: // mSendSecureXSiteReferrer: default is false, // if true allow referrer headers between secure non-matching hosts PRPackedBool mSendSecureXSiteReferrer; + + // Persitent HTTPS caching flag + PRPackedBool mEnablePersistentHttpsCaching; }; //-----------------------------------------------------------------------------