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

Unified Diff: net/http/http_response_headers.cc

Issue 40137: Clean up HttpResponseHeaders::IsKeepAlive. Use the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 years, 10 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
« no previous file with comments | « no previous file | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers.cc
===================================================================
--- net/http/http_response_headers.cc (revision 11044)
+++ net/http/http_response_headers.cc (working copy)
@@ -924,23 +924,19 @@
}
bool HttpResponseHeaders::IsKeepAlive() const {
- const char kPrefix[] = "HTTP/1.0";
- const size_t kPrefixLen = arraysize(kPrefix) - 1;
- if (raw_headers_.size() < kPrefixLen) // Lacking a status line?
+ if (http_version_ < HttpVersion(1, 0))
return false;
// NOTE: It is perhaps risky to assume that a Proxy-Connection header is
// meaningful when we don't know that this response was from a proxy, but
// Mozilla also does this, so we'll do the same.
std::string connection_val;
- void* iter = NULL;
- if (!EnumerateHeader(&iter, "connection", &connection_val))
- EnumerateHeader(&iter, "proxy-connection", &connection_val);
+ if (!EnumerateHeader(NULL, "connection", &connection_val))
+ EnumerateHeader(NULL, "proxy-connection", &connection_val);
bool keep_alive;
- if (std::equal(raw_headers_.begin(),
- raw_headers_.begin() + kPrefixLen, kPrefix)) {
+ if (http_version_ == HttpVersion(1, 0)) {
// HTTP/1.0 responses default to NOT keep-alive
keep_alive = LowerCaseEqualsASCII(connection_val, "keep-alive");
} else {
« no previous file with comments | « no previous file | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698