diff options
author | Henrik Baard <henrik.baard@sonyericsson.com> | 2010-08-16 13:18:10 +0200 |
---|---|---|
committer | Henrik Baard <henrik.baard@sonyericsson.com> | 2011-03-29 08:54:09 +0200 |
commit | eb0ced7a094df2c73e052a066535f4359b11a92d (patch) | |
tree | a444193c7d5eb009975c793dd622136e128b2b4b /core | |
parent | d973bed36cb4d4da1d97f309119f4114f60e7171 (diff) | |
download | frameworks_base-eb0ced7a094df2c73e052a066535f4359b11a92d.zip frameworks_base-eb0ced7a094df2c73e052a066535f4359b11a92d.tar.gz frameworks_base-eb0ced7a094df2c73e052a066535f4359b11a92d.tar.bz2 |
Error in compound cache-control header.
A cache control header containing both no-cache and max-age attribute does not
behave as expected.
Cache-Control: no-cache, max-age=200000
Will set expired to 20000ms seconds, ignoring the no-cache header. My
interpretation is that the no-cache header should not be ignored in
this case.
Change-Id: Iadd1900e4d2c6c0dacc6bb3e7b944cf78ca9b266
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/CacheManager.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java index d171990..eff8e61 100644 --- a/core/java/android/webkit/CacheManager.java +++ b/core/java/android/webkit/CacheManager.java @@ -752,6 +752,7 @@ public final class CacheManager { String cacheControl = headers.getCacheControl(); if (cacheControl != null) { String[] controls = cacheControl.toLowerCase().split("[ ,;]"); + boolean noCache = false; for (int i = 0; i < controls.length; i++) { if (NO_STORE.equals(controls[i])) { return null; @@ -762,7 +763,12 @@ public final class CacheManager { // can only be used in CACHE_MODE_CACHE_ONLY case if (NO_CACHE.equals(controls[i])) { ret.expires = 0; - } else if (controls[i].startsWith(MAX_AGE)) { + noCache = true; + // if cache control = no-cache has been received, ignore max-age + // header, according to http spec: + // If a request includes the no-cache directive, it SHOULD NOT + // include min-fresh, max-stale, or max-age. + } else if (controls[i].startsWith(MAX_AGE) && !noCache) { int separator = controls[i].indexOf('='); if (separator < 0) { separator = controls[i].indexOf(':'); |