summaryrefslogtreecommitdiffstats
path: root/net/http/http_response_headers.cc
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 22:02:38 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 22:02:38 +0000
commit1a616d92fc1bdafcceda50939e6a5b72f4885a98 (patch)
treee85ccb221c85ed8706e5ff1c3547980929a8f91b /net/http/http_response_headers.cc
parentfa080a88617754f2b4a75a482c546422b9ca4fe0 (diff)
downloadchromium_src-1a616d92fc1bdafcceda50939e6a5b72f4885a98.zip
chromium_src-1a616d92fc1bdafcceda50939e6a5b72f4885a98.tar.gz
chromium_src-1a616d92fc1bdafcceda50939e6a5b72f4885a98.tar.bz2
Clean up HttpResponseHeaders::IsKeepAlive. Use the parsed
HTTP version in the http_version_ member. Pass NULL to EnumerateHeader. R=eroman Review URL: http://codereview.chromium.org/40137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers.cc')
-rw-r--r--net/http/http_response_headers.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 536a571..8c2a0b3 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -924,23 +924,19 @@ bool HttpResponseHeaders::GetTimeValuedHeader(const std::string& name,
}
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 {