fixes bug 205921 "Preference browser.cache.disk_cache_ssl does nothing"

patch=pk_joshi@yahoo.com r+sr=darin
This commit is contained in:
darin%meer.net 2003-09-15 22:12:52 +00:00
Родитель 0e55428e0f
Коммит e4c6e7ec88
3 изменённых файлов: 20 добавлений и 2 удалений

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

@ -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;

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

@ -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
//

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

@ -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;
};
//-----------------------------------------------------------------------------