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 || |
+ 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) { |
+ 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; |