345181 cache SSL content that was sent with a Cache-Control: public header to
disk r+sr=darin git-svn-id: svn://10.0.0.236/trunk@240146 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c920b70348
commit
d293ae569b
@ -199,10 +199,6 @@ nsHttpChannel::Init(nsIURI *uri,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mConnectionInfo);
|
||||
|
||||
// make sure our load flags include this bit if this is a secure channel.
|
||||
if (usingSSL && !gHttpHandler->IsPersistentHttpsCachingEnabled())
|
||||
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
|
||||
|
||||
// Set default request method
|
||||
mRequestHead.SetMethod(nsHttp::Get);
|
||||
|
||||
@ -2013,8 +2009,12 @@ nsHttpChannel::InitCacheEntry()
|
||||
if (mResponseHead->NoStore())
|
||||
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
|
||||
|
||||
// For HTTPS transactions, the storage policy will already be IN_MEMORY.
|
||||
// We are concerned instead about load attributes which may have changed.
|
||||
// Only cache SSL content on disk if the server sent a
|
||||
// Cache-Control: public header, or if the user set the pref
|
||||
if (!gHttpHandler->CanCacheAllSSLContent() &&
|
||||
mConnectionInfo->UsingSSL() && !mResponseHead->CacheControlPublic())
|
||||
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
|
||||
|
||||
if (mLoadFlags & INHIBIT_PERSISTENT_CACHING) {
|
||||
rv = mCacheEntry->SetStoragePolicy(nsICache::STORE_IN_MEMORY);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@ -3462,12 +3462,6 @@ NS_IMETHODIMP
|
||||
nsHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags)
|
||||
{
|
||||
mLoadFlags = aLoadFlags;
|
||||
|
||||
// don't let anyone overwrite this bit if we're using a secure channel.
|
||||
if (mConnectionInfo && mConnectionInfo->UsingSSL()
|
||||
&& !gHttpHandler->IsPersistentHttpsCachingEnabled())
|
||||
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ public:
|
||||
nsIIDNService *IDNConverter() { return mIDNConverter; }
|
||||
PRUint32 PhishyUserPassLength() { return mPhishyUserPassLength; }
|
||||
|
||||
PRBool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; }
|
||||
PRBool CanCacheAllSSLContent() { return mEnablePersistentHttpsCaching; }
|
||||
|
||||
nsHttpAuthCache *AuthCache() { return &mAuthCache; }
|
||||
nsHttpConnectionMgr *ConnMgr() { return mConnMgr; }
|
||||
|
||||
@ -482,6 +482,7 @@ nsHttpResponseHead::Reset()
|
||||
mContentLength = LL_MAXUINT;
|
||||
mCacheControlNoStore = PR_FALSE;
|
||||
mCacheControlNoCache = PR_FALSE;
|
||||
mCacheControlPublic = PR_FALSE;
|
||||
mPragmaNoCache = PR_FALSE;
|
||||
mStatusText.Truncate();
|
||||
mContentType.Truncate();
|
||||
@ -631,6 +632,7 @@ nsHttpResponseHead::ParseCacheControl(const char *val)
|
||||
// clear flags
|
||||
mCacheControlNoCache = PR_FALSE;
|
||||
mCacheControlNoStore = PR_FALSE;
|
||||
mCacheControlPublic = PR_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -642,6 +644,10 @@ nsHttpResponseHead::ParseCacheControl(const char *val)
|
||||
// search header value for occurrence of "no-store"
|
||||
if (nsHttp::FindToken(val, "no-store", HTTP_HEADER_VALUE_SEPS))
|
||||
mCacheControlNoStore = PR_TRUE;
|
||||
|
||||
// search header value for occurrence of "public"
|
||||
if (nsHttp::FindToken(val, "public", HTTP_HEADER_VALUE_SEPS))
|
||||
mCacheControlPublic = PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -56,6 +56,7 @@ public:
|
||||
, mContentLength(LL_MAXUINT)
|
||||
, mCacheControlNoStore(PR_FALSE)
|
||||
, mCacheControlNoCache(PR_FALSE)
|
||||
, mCacheControlPublic(PR_FALSE)
|
||||
, mPragmaNoCache(PR_FALSE) {}
|
||||
~nsHttpResponseHead()
|
||||
{
|
||||
@ -71,6 +72,7 @@ public:
|
||||
const nsAFlatCString &ContentCharset() { return mContentCharset; }
|
||||
PRBool NoStore() { return mCacheControlNoStore; }
|
||||
PRBool NoCache() { return (mCacheControlNoCache || mPragmaNoCache); }
|
||||
PRBool CacheControlPublic() { return mCacheControlPublic; }
|
||||
/**
|
||||
* Full length of the entity. For byte-range requests, this may be larger
|
||||
* than ContentLength(), which will only represent the requested part of the
|
||||
@ -148,6 +150,7 @@ private:
|
||||
nsCString mContentCharset;
|
||||
PRPackedBool mCacheControlNoStore;
|
||||
PRPackedBool mCacheControlNoCache;
|
||||
PRPackedBool mCacheControlPublic;
|
||||
PRPackedBool mPragmaNoCache;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user