Fix evaluation of "Cache-Control: no-cache, no-store" header value (see issue #2283)

Choose the stricter "no-cache" behavior which implies the "no-store" behavior.
This commit is contained in:
Marshall Greenblatt 2019-05-21 17:51:39 +03:00
parent 6011d45e38
commit 35295d2e27
1 changed files with 5 additions and 2 deletions

View File

@ -168,13 +168,16 @@ blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) {
const bool only_from_cache{ur_flags & UR_FLAG_ONLY_FROM_CACHE};
const bool disable_cache{ur_flags & UR_FLAG_DISABLE_CACHE};
if (only_from_cache && (skip_cache || disable_cache)) {
// The request will always fail because only_from_cache and
// skip_cache/disable_cache are mutually exclusive.
return blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss;
} else if (disable_cache) {
// This additionally implies the skip_cache behavior.
return blink::mojom::FetchCacheMode::kNoStore;
} else if (skip_cache) {
return blink::mojom::FetchCacheMode::kBypassCache;
} else if (only_from_cache) {
return blink::mojom::FetchCacheMode::kOnlyIfCached;
} else if (disable_cache) {
return blink::mojom::FetchCacheMode::kNoStore;
}
return blink::mojom::FetchCacheMode::kDefault;
}