Chromium Code Reviews| Index: net/http/http_response_headers.cc |
| diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc |
| index 88017d0b93ecfb286c2a2503c3a94ef814a56bfb..1234c4366be06a4cfc031420821c1969ad5d0778 100644 |
| --- a/net/http/http_response_headers.cc |
| +++ b/net/http/http_response_headers.cc |
| @@ -1419,6 +1419,30 @@ bool HttpResponseHeaders::GetChromeProxyInfo( |
| return false; |
| } |
| + |
| +bool HttpResponseHeaders::IsChromeProxyResponse() const { |
| + const size_t kVersionSize = 4; |
| + const char kChromeProxyViaValue[] = "Chrome-Compression-Proxy"; |
| + size_t value_len = strlen(kChromeProxyViaValue); |
| + void* iter = NULL; |
| + std::string value; |
| + |
| + // Case-sensitive comparison of |value|. Assumes the received protocol and the |
| + // space following it are always |kVersionSize| characters. E.g., |
| + // 'Via: 1.1 Chrome-Compression-Proxy' |
| + while (EnumerateHeader(&iter, "via", &value)) { |
| + if (!value.compare(kVersionSize, value_len, kChromeProxyViaValue)) |
| + return true; |
| + } |
| + |
| + // TODO(bengr): Remove deprecated header value. |
| + const char kDeprecatedChromeProxyViaValue[] = "1.1 Chrome Compression Proxy"; |
| + iter = NULL; |
| + while (EnumerateHeader(&iter, "via", &value)) |
| + if (value == kDeprecatedChromeProxyViaValue) return true; |
|
Lei Zhang
2014/02/13 01:36:32
nit: return true should be on its own line.
bengr
2014/02/13 16:57:36
Done.
|
| + |
| + return false; |
| +} |
| #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
| } // namespace net |