| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // The rules for header parsing were borrowed from Firefox: | 5 // The rules for header parsing were borrowed from Firefox: |
| 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo
nseHead.cpp | 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo
nseHead.cpp |
| 7 // The rules for parsing content-types were also borrowed from Firefox: | 7 // The rules for parsing content-types were also borrowed from Firefox: |
| 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
| 9 | 9 |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 924 } |
| 925 | 925 |
| 926 bool HttpResponseHeaders::IsKeepAlive() const { | 926 bool HttpResponseHeaders::IsKeepAlive() const { |
| 927 if (http_version_ < HttpVersion(1, 0)) | 927 if (http_version_ < HttpVersion(1, 0)) |
| 928 return false; | 928 return false; |
| 929 | 929 |
| 930 // NOTE: It is perhaps risky to assume that a Proxy-Connection header is | 930 // NOTE: It is perhaps risky to assume that a Proxy-Connection header is |
| 931 // meaningful when we don't know that this response was from a proxy, but | 931 // meaningful when we don't know that this response was from a proxy, but |
| 932 // Mozilla also does this, so we'll do the same. | 932 // Mozilla also does this, so we'll do the same. |
| 933 std::string connection_val; | 933 std::string connection_val; |
| 934 if (!EnumerateHeader(NULL, "connection", &connection_val)) | 934 // TODO(wtc): A temporary change to look for "proxy-connection" before |
| 935 EnumerateHeader(NULL, "proxy-connection", &connection_val); | 935 // "connection" for debugging http://crbug.com/8325. |
| 936 if (!EnumerateHeader(NULL, "proxy-connection", &connection_val)) |
| 937 EnumerateHeader(NULL, "connection", &connection_val); |
| 936 | 938 |
| 937 bool keep_alive; | 939 bool keep_alive; |
| 938 | 940 |
| 939 if (http_version_ == HttpVersion(1, 0)) { | 941 if (http_version_ == HttpVersion(1, 0)) { |
| 940 // HTTP/1.0 responses default to NOT keep-alive | 942 // HTTP/1.0 responses default to NOT keep-alive |
| 941 keep_alive = LowerCaseEqualsASCII(connection_val, "keep-alive"); | 943 keep_alive = LowerCaseEqualsASCII(connection_val, "keep-alive"); |
| 942 } else { | 944 } else { |
| 943 // HTTP/1.1 responses default to keep-alive | 945 // HTTP/1.1 responses default to keep-alive |
| 944 keep_alive = !LowerCaseEqualsASCII(connection_val, "close"); | 946 keep_alive = !LowerCaseEqualsASCII(connection_val, "close"); |
| 945 } | 947 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 963 | 965 |
| 964 int64 result; | 966 int64 result; |
| 965 bool ok = StringToInt64(content_length_val, &result); | 967 bool ok = StringToInt64(content_length_val, &result); |
| 966 if (!ok || result < 0) | 968 if (!ok || result < 0) |
| 967 return -1; | 969 return -1; |
| 968 | 970 |
| 969 return result; | 971 return result; |
| 970 } | 972 } |
| 971 | 973 |
| 972 } // namespace net | 974 } // namespace net |
| OLD | NEW |