diff options
author | twifkak <twifkak@chromium.org> | 2015-08-11 11:18:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-11 18:18:47 +0000 |
commit | f50ac9a7e506173b9db2d4d7c94a9534c284ba23 (patch) | |
tree | 5de6c6e6dad791fbbccd4eb240498f6119fba121 /components/precache | |
parent | 11f35f17afa56b979fac1dc6f283e519adddf96a (diff) | |
download | chromium_src-f50ac9a7e506173b9db2d4d7c94a9534c284ba23.zip chromium_src-f50ac9a7e506173b9db2d4d7c94a9534c284ba23.tar.gz chromium_src-f50ac9a7e506173b9db2d4d7c94a9534c284ba23.tar.bz2 |
Prefetch requests using LOAD_VALIDATE_CACHE.
This tells the URLFetcher to revalidate the resources (e.g. against
Last-Modified, ETag, etc.). Consequently, in the case of a 304, this
will update the Date/Expires headers in our cache without costing us
network bytes.
BUG=309216
Review URL: https://codereview.chromium.org/1279833007
Cr-Commit-Position: refs/heads/master@{#342845}
Diffstat (limited to 'components/precache')
-rw-r--r-- | components/precache/core/precache_fetcher.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc index 1ffcd8c..fe5701c 100644 --- a/components/precache/core/precache_fetcher.cc +++ b/components/precache/core/precache_fetcher.cc @@ -162,7 +162,14 @@ PrecacheFetcher::Fetcher::Fetcher( : callback_(callback), response_bytes_(0), network_response_bytes_(0) { url_fetcher_ = URLFetcher::Create(url, URLFetcher::GET, this); url_fetcher_->SetRequestContext(request_context); - url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | + // LOAD_VALIDATE_CACHE allows us to refresh the cache by updating Date + // headers, without costing network bytes, as cache hits will return 304s. + // LOAD_DO_NOT_*_COOKIES is for privacy reasons. If a user clears their + // cookies, but a tracking beacon is prefetched and the beacon specifies its + // source URL in a URL param, the beacon site would be able to rebuild a + // profile of the user. + url_fetcher_->SetLoadFlags(net::LOAD_VALIDATE_CACHE | + net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); if (ignore_response_body) { scoped_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter); |