Index: components/data_reduction_proxy/browser/data_reduction_proxy_params.cc |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc |
index 64b2ec1040c4cc533310f3826651f2c22525cdbd..41a714817d4926aede8359f6d59dc981485a173b 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc |
@@ -329,6 +329,38 @@ std::string DataReductionProxyParams::GetDefaultDevOrigin() const { |
return std::string(); |
} |
+bool DataReductionProxyParams::WereDataReductionProxiesBypassed( |
+ const net::URLRequest* request) const { |
+ DataReductionProxyParams::DataReductionProxyList proxies = |
+ GetAllowedProxies(); |
+ if (proxies.size() == 0) |
+ return false; |
+ |
+ if (request == NULL || request->context() == NULL || |
bengr
2014/07/16 01:40:09
Are any of these NULL in practice? I'd prefer:
DCH
|
+ request->context()->proxy_service() == NULL) { |
+ return false; |
+ } |
+ |
+ const net::ProxyRetryInfoMap& retry_map = |
+ request->context()->proxy_service()->proxy_retry_info(); |
+ if (retry_map.size() == 0) |
+ return false; |
+ |
+ // The request is bypassed if all configured proxies are in the retry map. |
+ for (size_t i = 0; i < proxies.size(); ++i) { |
bengr
2014/07/16 01:40:10
This isn't right if alt proxies are involved. If t
megjablon
2014/07/16 23:07:14
This is based on:
https://code.google.com/p/chro
bengr
2014/07/16 23:28:14
Yes
|
+ std::string proxy = net::HostPortPair::FromURL(proxies[i]).ToString(); |
+ // The retry list has the scheme prefix for https but not for http. |
+ if (proxies[i].SchemeIs("https")) |
+ proxy = std::string("https://") + proxy; |
+ |
+ net::ProxyRetryInfoMap::const_iterator found = retry_map.find(proxy); |
+ if (found == retry_map.end()) |
+ return false; |
+ |
+ } |
+ return true; |
+} |
+ |
std::string DataReductionProxyParams::GetDefaultOrigin() const { |
#if defined(SPDY_PROXY_AUTH_ORIGIN) |
return SPDY_PROXY_AUTH_ORIGIN; |