Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: content/browser/download/download_resource_handler.cc

Issue 67883007: [Downloads] Don't store or use validators unless they are strong. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/tools/testserver/testserver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_resource_handler.cc
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index 3e460b3f0698b13c232cb999f30edfc581a76a02..9f00ef660b53a4a43cecf1eb89f6eabde3e3cb71 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -168,12 +168,15 @@ bool DownloadResourceHandler::OnResponseStarted(
// Get the last modified time and etag.
const net::HttpResponseHeaders* headers = request()->response_headers();
if (headers) {
- // TODO(asanka): Only store these if headers->HasStrongValidators() is true.
- // See RFC 2616 section 13.3.3.
- if (!headers->EnumerateHeader(NULL, "Last-Modified", &info->last_modified))
- info->last_modified.clear();
- if (!headers->EnumerateHeader(NULL, "ETag", &info->etag))
- info->etag.clear();
+ if (headers->HasStrongValidators()) {
+ // If we don't have strong validators as per RFC 2616 section 13.3.3, then
+ // we neither store nor use them for range requests.
+ if (!headers->EnumerateHeader(NULL, "Last-Modified",
+ &info->last_modified))
+ info->last_modified.clear();
+ if (!headers->EnumerateHeader(NULL, "ETag", &info->etag))
+ info->etag.clear();
+ }
int status = headers->response_code();
if (2 == status / 100 && status != net::HTTP_PARTIAL_CONTENT) {
« no previous file with comments | « no previous file | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698