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

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

Issue 510353004: Fixing DataReductionProxy.BypassedBytes.LocalBypassRules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr comments Created 6 years, 4 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 1dfbaaa89ada462b7362394994b18db2a6effe55..3088e083eabe41bbfde98532a6d12f9ec78fc1fd 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc
@@ -12,6 +12,7 @@
#include "base/time/time.h"
#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
#include "net/base/host_port_pair.h"
+#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_retry_info.h"
#include "net/proxy/proxy_server.h"
@@ -366,6 +367,21 @@ bool DataReductionProxyParams::IsDataReductionProxyEligible(
return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL);
}
+bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
+ const net::URLRequest& request,
+ const net::ProxyConfig& data_reduction_proxy_config) const {
+ DCHECK(request.context());
+ DCHECK(request.context()->proxy_service());
+ net::ProxyInfo result;
+ data_reduction_proxy_config.proxy_rules().Apply(
+ request.url(), &result);
+ if (!result.proxy_server().is_valid())
+ return true;
+ if (result.proxy_server().is_direct())
+ return true;
+ return !IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL);
+}
+
std::string DataReductionProxyParams::GetDefaultDevOrigin() const {
#if defined(DATA_REDUCTION_DEV_HOST)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();

Powered by Google App Engine
This is Rietveld 408576698