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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_params.cc

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed logging and fixed MaybeBypassProxyAndPrepareToRetry Created 6 years, 5 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
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;

Powered by Google App Engine
This is Rietveld 408576698