Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: net/http/http_response_headers.cc

Issue 156373002: Support for new data reduction proxy via header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation error on unsupported platforms Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_headers.h ('k') | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0072976ada2e16891a487683d7c2ed1dd214be71 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -1419,6 +1419,31 @@ 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;
+
+ return false;
+}
#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
} // namespace net
« no previous file with comments | « net/http/http_response_headers.h ('k') | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698