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

Unified Diff: net/http/http_response_headers.cc

Issue 10387200: Suppress pause-and-buffer behavior when the HTTP response won't satisfy future requests via cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted GetReasonsForUncacheability and added tests. Created 8 years, 7 months 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
Index: net/http/http_response_headers.cc
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 33d78dad0dee6ed21f634baa6fdc2b32ba9d4825..ea7019d2bd115e0bd2de25bc185d0425e9afb42b 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -1160,32 +1160,14 @@ bool HttpResponseHeaders::IsKeepAlive() const {
}
bool HttpResponseHeaders::HasStrongValidators() const {
- if (GetHttpVersion() < HttpVersion(1, 1))
- return false;
-
- std::string etag_value;
- EnumerateHeader(NULL, "etag", &etag_value);
- if (!etag_value.empty()) {
- size_t slash = etag_value.find('/');
- if (slash == std::string::npos || slash == 0)
- return true;
-
- std::string::const_iterator i = etag_value.begin();
- std::string::const_iterator j = etag_value.begin() + slash;
- HttpUtil::TrimLWS(&i, &j);
- if (!LowerCaseEqualsASCII(i, j, "w"))
- return true;
- }
-
- Time last_modified;
- if (!GetLastModifiedValue(&last_modified))
- return false;
-
- Time date;
- if (!GetDateValue(&date))
- return false;
-
- return ((date - last_modified).InSeconds() >= 60);
+ std::string etag_header;
+ EnumerateHeader(NULL, "etag", &etag_header);
+ std::string last_modified_header;
+ EnumerateHeader(NULL, "Last-Modified", &last_modified_header);
scherkus (not reviewing) 2012/05/23 01:16:03 FYI I notice a lot of lower-case headers in this f
Ami GONE FROM CHROMIUM 2012/05/23 01:27:28 Elected to stay consistent with existing capitaliz
scherkus (not reviewing) 2012/05/23 01:34:19 Yeah nevermind -- the stuff at the top of this fil
+ std::string date_header;
+ EnumerateHeader(NULL, "Date", &last_modified_header);
+ return HttpUtil::HasStrongValidators(
+ GetHttpVersion(), etag_header, last_modified_header, date_header);
rvargas (doing something else) 2012/05/23 02:04:12 nit: this call should start enumerating arguments
Ami GONE FROM CHROMIUM 2012/05/23 03:55:23 That'd require ASCII art and more vertical space t
rvargas (doing something else) 2012/05/23 18:26:09 Just look at the Google style guide.
}
// From RFC 2616:
« no previous file with comments | « content/content_tests.gypi ('k') | net/http/http_util.h » ('j') | net/http/http_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698