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..39ef6985023d4f479054f4dd952d66456c09d6c9 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. 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)) { |
mef
2014/02/12 18:12:19
If it is case sensitive, shouldn't it be 'Via' ins
bengr
2014/02/12 21:14:00
The value comparison is case sensitive. The Header
|
+ 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; |
+ |
+ return false; |
+} |
#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
} // namespace net |