| Index: net/http/http_network_transaction.cc
|
| diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
|
| index 96817e2b14fa2c1bb96ff827015943e96c6aedf0..6561a0aad23e47ac9dbc210888868f1247cd0b79 100644
|
| --- a/net/http/http_network_transaction.cc
|
| +++ b/net/http/http_network_transaction.cc
|
| @@ -126,19 +126,28 @@ bool IsChromeProxyResponse(const net::HttpResponseHeaders* response_headers) {
|
| if (!response_headers) {
|
| return false;
|
| }
|
| - const char kDataReductionProxyViaValue[] = "1.1 Chrome Compression Proxy";
|
| +
|
| + const size_t kVersionSize = 4;
|
| + const char kDataReductionProxyViaValue[] = "Chrome-Compression-Proxy";
|
| size_t value_len = strlen(kDataReductionProxyViaValue);
|
| void* iter = NULL;
|
| - std::string temp;
|
| - while (response_headers->EnumerateHeader(&iter, "Via", &temp)) {
|
| - std::string::const_iterator it =
|
| - std::search(temp.begin(), temp.end(),
|
| - kDataReductionProxyViaValue,
|
| - kDataReductionProxyViaValue + value_len,
|
| - base::CaseInsensitiveCompareASCII<char>());
|
| - if (it != temp.end())
|
| + std::string value;
|
| +
|
| + // Case-sensitive comparison. Assumes the received protocol and the space
|
| + // following it are always |kVersionSize| characters. E.g.,
|
| + // 'Via: 1.1 Chrome-Compression-Proxy'
|
| + while (response_headers->EnumerateHeader(&iter, "via", &value)) {
|
| + if (!value.compare(kVersionSize, value_len, kDataReductionProxyViaValue))
|
| return true;
|
| }
|
| +
|
| + // TODO(bengr): Remove deprecated header value.
|
| + const char kDeprecatedDataReductionProxyViaValue[] =
|
| + "1.1 Chrome Compression Proxy";
|
| + iter = NULL;
|
| + while (response_headers->EnumerateHeader(&iter, "via", &value))
|
| + if (value == kDeprecatedDataReductionProxyViaValue) return true;
|
| +
|
| return false;
|
| }
|
| #endif
|
|
|