am 7fdab7f9: Merge change 22377 into eclair

Merge commit '7fdab7f9674aadf90c3be1f06d7d34b60151c658' into eclair-plus-aosp

* commit '7fdab7f9674aadf90c3be1f06d7d34b60151c658':
  The new webkit won't keep RAM cache if http header has "no-store". So remove
This commit is contained in:
Grace Kloba
2009-08-24 08:47:01 -07:00
committed by Android Git Automerger
3 changed files with 10 additions and 8 deletions

View File

@@ -105,8 +105,7 @@ class ContentLoader extends StreamLoader {
if (mContentType != null) { if (mContentType != null) {
headers.setContentType("text/html"); headers.setContentType("text/html");
} }
// override the cache-control header set by StreamLoader as content can // content can change, we don't want WebKit to cache it
// change, we don't want WebKit to cache it
headers.setCacheControl("no-store, no-cache"); headers.setCacheControl("no-store, no-cache");
} }

View File

@@ -99,6 +99,7 @@ class LoadListener extends Handler implements EventHandler {
private boolean mAuthFailed; // indicates that the prev. auth failed private boolean mAuthFailed; // indicates that the prev. auth failed
private CacheLoader mCacheLoader; private CacheLoader mCacheLoader;
private CacheManager.CacheResult mCacheResult; private CacheManager.CacheResult mCacheResult;
private boolean mFromCache = false;
private HttpAuthHeader mAuthHeader; private HttpAuthHeader mAuthHeader;
private int mErrorID = OK; private int mErrorID = OK;
private String mErrorDescription; private String mErrorDescription;
@@ -409,11 +410,10 @@ class LoadListener extends Handler implements EventHandler {
mStatusCode == HTTP_MOVED_PERMANENTLY || mStatusCode == HTTP_MOVED_PERMANENTLY ||
mStatusCode == HTTP_TEMPORARY_REDIRECT) && mStatusCode == HTTP_TEMPORARY_REDIRECT) &&
mNativeLoader != 0) { mNativeLoader != 0) {
// Content arriving from a StreamLoader (eg File, Cache or Data) if (!mFromCache && URLUtil.isNetworkUrl(mUrl)) {
// will not be cached as they have the header: mCacheResult = CacheManager.createCacheFile(mUrl, mStatusCode,
// cache-control: no-store headers, mMimeType, false);
mCacheResult = CacheManager.createCacheFile(mUrl, mStatusCode, }
headers, mMimeType, false);
if (mCacheResult != null) { if (mCacheResult != null) {
mCacheResult.encoding = mEncoding; mCacheResult.encoding = mEncoding;
} }
@@ -626,6 +626,7 @@ class LoadListener extends Handler implements EventHandler {
* serviced by the Cache. */ * serviced by the Cache. */
/* package */ void setCacheLoader(CacheLoader c) { /* package */ void setCacheLoader(CacheLoader c) {
mCacheLoader = c; mCacheLoader = c;
mFromCache = true;
} }
/** /**
@@ -642,6 +643,8 @@ class LoadListener extends Handler implements EventHandler {
// Go ahead and set the cache loader to null in case the result is // Go ahead and set the cache loader to null in case the result is
// null. // null.
mCacheLoader = null; mCacheLoader = null;
// reset the flag
mFromCache = false;
if (result != null) { if (result != null) {
// The contents of the cache may need to be revalidated so just // The contents of the cache may need to be revalidated so just
@@ -662,6 +665,7 @@ class LoadListener extends Handler implements EventHandler {
} }
// Load the cached file // Load the cached file
mCacheLoader.load(); mCacheLoader.load();
mFromCache = true;
return true; return true;
} }
} }

View File

@@ -157,7 +157,6 @@ abstract class StreamLoader extends Handler {
if (mContentLength > 0) { if (mContentLength > 0) {
headers.setContentLength(mContentLength); headers.setContentLength(mContentLength);
} }
headers.setCacheControl(NO_STORE);
buildHeaders(headers); buildHeaders(headers);
mHandler.headers(headers); mHandler.headers(headers);
} }