Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index 5d07c8721e853a44ff17b0f5f126615bb2a273e4..d4159523acf628b68fed663ffed4a68238b9c44b 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -354,6 +354,34 @@ class UnsetProxyConfigService : public ProxyConfigService { |
| }; |
| #endif |
| +// Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. |
|
bengr
2015/05/10 16:49:34
Consider limiting all of this logic to android and
Not at Google. Contact bengr
2015/05/11 17:24:09
Can we verify that this does not affect desktop? I
sclittle
2015/05/11 20:43:36
But either way, this code would only remove data r
|
| +void RemoveGooglezipDataReductionProxies(ProxyList* proxy_list) { |
|
bengr
2015/05/10 16:49:34
Add a TODO to add UMA to track how often this is c
sclittle
2015/05/11 20:43:36
Done.
|
| + if (proxy_list->IsEmpty()) |
|
bengr
2015/05/10 16:49:34
#include "net/proxy/proxy_list.h"
sclittle
2015/05/11 20:43:36
Done.
|
| + return; |
| + |
| + ProxyList replacement_list; |
| + for (const ProxyServer& proxy : proxy_list->GetAll()) { |
| + if (!proxy.is_valid() || proxy.is_direct() || |
| + !EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true)) { |
| + replacement_list.AddProxyServer(proxy); |
|
bengr
2015/05/10 16:49:33
add an else clause that sets found_googlezip_proxy
sclittle
2015/05/11 20:43:36
Instead of using a bool variable, I just check if
|
| + } |
| + } |
| + |
| + if (replacement_list.IsEmpty()) |
| + replacement_list.AddProxyServer(ProxyServer::Direct()); |
|
bengr
2015/05/10 16:49:34
Is this the contents of a list when there's no con
Not at Google. Contact bengr
2015/05/11 17:24:09
Instead of setting ProxyServer::Direct(), you shou
sclittle
2015/05/11 20:43:36
Re bengr: It's possible that the DRP was configure
|
| + *proxy_list = replacement_list; |
|
bengr
2015/05/10 16:49:34
replace only if found_googlezip_proxy is true.
sclittle
2015/05/11 20:43:36
Done, but instead of using a found_googlezip_proxy
|
| +} |
| + |
| +// Remove any Data Reduction Proxies like *.googlezip.net from |proxy_rules|. |
| +void RemoveGooglezipDataReductionProxiesFromRules( |
| + ProxyConfig::ProxyRules* proxy_rules) { |
| + RemoveGooglezipDataReductionProxies(&proxy_rules->fallback_proxies); |
|
bengr
2015/05/10 16:49:34
#include "net/proxy/proxy_config.h"
sclittle
2015/05/11 20:43:36
Done.
|
| + RemoveGooglezipDataReductionProxies(&proxy_rules->proxies_for_ftp); |
| + RemoveGooglezipDataReductionProxies(&proxy_rules->proxies_for_http); |
|
bengr
2015/05/10 16:49:34
We only ever set HTTP. I can understand checking f
sclittle
2015/05/11 20:43:36
For thoroughness; there's no harm in checking the
|
| + RemoveGooglezipDataReductionProxies(&proxy_rules->proxies_for_https); |
| + RemoveGooglezipDataReductionProxies(&proxy_rules->single_proxies); |
| +} |
| + |
| } // namespace |
| // ProxyService::InitProxyResolver -------------------------------------------- |
| @@ -1160,10 +1188,21 @@ void ProxyService::SuspendAllPendingRequests() { |
| } |
| } |
| +namespace {} // namespace |
| + |
| void ProxyService::SetReady() { |
| DCHECK(!init_proxy_resolver_.get()); |
| current_state_ = STATE_READY; |
| + // Remove any Data Reduction Proxies like *.googlezip.net from the proxy |
| + // config rules, since specifying a DRP in the proxy rules is not a supported |
| + // means of activating the DRP, and could cause requests to be sent to the DRP |
| + // without the appropriate authentication headers and without using any of the |
| + // DRP bypass logic. |
| + // TODO(sclittle): This is a temporary hotfix for http://crbug.com/476610, and |
| + // should be removed once that bug is fixed and verified. |
| + RemoveGooglezipDataReductionProxiesFromRules(&config_.proxy_rules()); |
|
bengr
2015/05/10 16:49:34
Please explain when you expect this to be called.
sclittle
2015/05/11 20:43:36
Added comment. This will be called whenever SetRea
|
| + |
| // Make a copy in case |this| is deleted during the synchronous completion |
| // of one of the requests. If |this| is deleted then all of the PacRequest |
| // instances will be Cancel()-ed. |