Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 ~UnsetProxyConfigService() override {} | 347 ~UnsetProxyConfigService() override {} |
| 348 | 348 |
| 349 void AddObserver(Observer* observer) override {} | 349 void AddObserver(Observer* observer) override {} |
| 350 void RemoveObserver(Observer* observer) override {} | 350 void RemoveObserver(Observer* observer) override {} |
| 351 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override { | 351 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override { |
| 352 return CONFIG_UNSET; | 352 return CONFIG_UNSET; |
| 353 } | 353 } |
| 354 }; | 354 }; |
| 355 #endif | 355 #endif |
| 356 | 356 |
| 357 // 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
| |
| 358 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.
| |
| 359 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.
| |
| 360 return; | |
| 361 | |
| 362 ProxyList replacement_list; | |
| 363 for (const ProxyServer& proxy : proxy_list->GetAll()) { | |
| 364 if (!proxy.is_valid() || proxy.is_direct() || | |
| 365 !EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true)) { | |
| 366 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
| |
| 367 } | |
| 368 } | |
| 369 | |
| 370 if (replacement_list.IsEmpty()) | |
| 371 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
| |
| 372 *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
| |
| 373 } | |
| 374 | |
| 375 // Remove any Data Reduction Proxies like *.googlezip.net from |proxy_rules|. | |
| 376 void RemoveGooglezipDataReductionProxiesFromRules( | |
| 377 ProxyConfig::ProxyRules* proxy_rules) { | |
| 378 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.
| |
| 379 RemoveGooglezipDataReductionProxies(&proxy_rules->proxies_for_ftp); | |
| 380 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
| |
| 381 RemoveGooglezipDataReductionProxies(&proxy_rules->proxies_for_https); | |
| 382 RemoveGooglezipDataReductionProxies(&proxy_rules->single_proxies); | |
| 383 } | |
| 384 | |
| 357 } // namespace | 385 } // namespace |
| 358 | 386 |
| 359 // ProxyService::InitProxyResolver -------------------------------------------- | 387 // ProxyService::InitProxyResolver -------------------------------------------- |
| 360 | 388 |
| 361 // This glues together two asynchronous steps: | 389 // This glues together two asynchronous steps: |
| 362 // (1) ProxyScriptDecider -- try to fetch/validate a sequence of PAC scripts | 390 // (1) ProxyScriptDecider -- try to fetch/validate a sequence of PAC scripts |
| 363 // to figure out what we should configure against. | 391 // to figure out what we should configure against. |
| 364 // (2) Feed the fetched PAC script into the ProxyResolver. | 392 // (2) Feed the fetched PAC script into the ProxyResolver. |
| 365 // | 393 // |
| 366 // InitProxyResolver is a single-use class which encapsulates cancellation as | 394 // InitProxyResolver is a single-use class which encapsulates cancellation as |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1153 PacRequest* req = it->get(); | 1181 PacRequest* req = it->get(); |
| 1154 if (req->is_started()) { | 1182 if (req->is_started()) { |
| 1155 req->CancelResolveJob(); | 1183 req->CancelResolveJob(); |
| 1156 | 1184 |
| 1157 req->net_log()->BeginEvent( | 1185 req->net_log()->BeginEvent( |
| 1158 NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); | 1186 NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); |
| 1159 } | 1187 } |
| 1160 } | 1188 } |
| 1161 } | 1189 } |
| 1162 | 1190 |
| 1191 namespace {} // namespace | |
| 1192 | |
| 1163 void ProxyService::SetReady() { | 1193 void ProxyService::SetReady() { |
| 1164 DCHECK(!init_proxy_resolver_.get()); | 1194 DCHECK(!init_proxy_resolver_.get()); |
| 1165 current_state_ = STATE_READY; | 1195 current_state_ = STATE_READY; |
| 1166 | 1196 |
| 1197 // Remove any Data Reduction Proxies like *.googlezip.net from the proxy | |
| 1198 // config rules, since specifying a DRP in the proxy rules is not a supported | |
| 1199 // means of activating the DRP, and could cause requests to be sent to the DRP | |
| 1200 // without the appropriate authentication headers and without using any of the | |
| 1201 // DRP bypass logic. | |
| 1202 // TODO(sclittle): This is a temporary hotfix for http://crbug.com/476610, and | |
| 1203 // should be removed once that bug is fixed and verified. | |
| 1204 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
| |
| 1205 | |
| 1167 // Make a copy in case |this| is deleted during the synchronous completion | 1206 // Make a copy in case |this| is deleted during the synchronous completion |
| 1168 // of one of the requests. If |this| is deleted then all of the PacRequest | 1207 // of one of the requests. If |this| is deleted then all of the PacRequest |
| 1169 // instances will be Cancel()-ed. | 1208 // instances will be Cancel()-ed. |
| 1170 PendingRequests pending_copy = pending_requests_; | 1209 PendingRequests pending_copy = pending_requests_; |
| 1171 | 1210 |
| 1172 for (PendingRequests::iterator it = pending_copy.begin(); | 1211 for (PendingRequests::iterator it = pending_copy.begin(); |
| 1173 it != pending_copy.end(); | 1212 it != pending_copy.end(); |
| 1174 ++it) { | 1213 ++it) { |
| 1175 PacRequest* req = it->get(); | 1214 PacRequest* req = it->get(); |
| 1176 if (!req->is_started() && !req->was_cancelled()) { | 1215 if (!req->is_started() && !req->was_cancelled()) { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1631 State previous_state = ResetProxyConfig(false); | 1670 State previous_state = ResetProxyConfig(false); |
| 1632 if (previous_state != STATE_NONE) | 1671 if (previous_state != STATE_NONE) |
| 1633 ApplyProxyConfigIfAvailable(); | 1672 ApplyProxyConfigIfAvailable(); |
| 1634 } | 1673 } |
| 1635 | 1674 |
| 1636 void ProxyService::OnDNSChanged() { | 1675 void ProxyService::OnDNSChanged() { |
| 1637 OnIPAddressChanged(); | 1676 OnIPAddressChanged(); |
| 1638 } | 1677 } |
| 1639 | 1678 |
| 1640 } // namespace net | 1679 } // namespace net |
| OLD | NEW |