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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc

Issue 836583002: Add support for field trial group to relax missing via header bypass logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused include from aw_url_request_context_getter.cc Created 5 years, 11 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/core/browser/data_reduction_proxy_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index c435c958e09ec04df3da96cd1361db1abcfc8a48..9ef087b0ced722e1a3e74496f1086a6f95932406 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -11,10 +11,12 @@
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
+#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
+#include "net/proxy/proxy_info.h"
+#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_status.h"
@@ -145,6 +147,8 @@ void DataReductionProxyNetworkDelegate::OnResolveProxyInternal(
int load_flags,
const net::ProxyService& proxy_service,
net::ProxyInfo* result) {
+ // TODO(sclittle): Call OnResolveProxyHandler directly, see
+ // http://crbug.com/447346.
if (!on_resolve_proxy_handler_.is_null() &&
!proxy_config_getter_.is_null()) {
on_resolve_proxy_handler_.Run(
@@ -251,4 +255,37 @@ void DataReductionProxyNetworkDelegate::AccumulateContentLength(
original_content_length_ += original_content_length;
}
+void OnResolveProxyHandler(const GURL& url,
+ int load_flags,
+ const net::ProxyConfig& data_reduction_proxy_config,
+ const net::ProxyRetryInfoMap& proxy_retry_info,
+ const DataReductionProxyParams* params,
+ net::ProxyInfo* result) {
+ DCHECK(params);
+ DCHECK(result->is_empty() || result->is_direct() ||
+ !params->IsDataReductionProxy(result->proxy_server().host_port_pair(),
+ NULL));
+ if (data_reduction_proxy_config.is_valid() &&
+ result->proxy_server().is_direct() &&
+ result->proxy_list().size() == 1 &&
+ !url.SchemeIsWSOrWSS()) {
+ net::ProxyInfo data_reduction_proxy_info;
+ data_reduction_proxy_config.proxy_rules().Apply(
+ url, &data_reduction_proxy_info);
+ data_reduction_proxy_info.DeprioritizeBadProxies(proxy_retry_info);
+ if (!data_reduction_proxy_info.proxy_server().is_direct())
+ result->OverrideProxyList(data_reduction_proxy_info.proxy_list());
+ }
+
+ if ((load_flags & net::LOAD_BYPASS_DATA_REDUCTION_PROXY) &&
+ DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial()) {
+ if (!result->is_empty() &&
+ !result->is_direct() &&
+ params->IsDataReductionProxy(result->proxy_server().host_port_pair(),
+ NULL)) {
+ result->RemoveProxiesWithoutScheme(net::ProxyServer::SCHEME_DIRECT);
+ }
+ }
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698