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 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 const ProxyService::PacPollPolicy* | 760 const ProxyService::PacPollPolicy* |
761 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; | 761 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; |
762 | 762 |
763 // ProxyService::PacRequest --------------------------------------------------- | 763 // ProxyService::PacRequest --------------------------------------------------- |
764 | 764 |
765 class ProxyService::PacRequest | 765 class ProxyService::PacRequest |
766 : public base::RefCounted<ProxyService::PacRequest> { | 766 : public base::RefCounted<ProxyService::PacRequest> { |
767 public: | 767 public: |
768 PacRequest(ProxyService* service, | 768 PacRequest(ProxyService* service, |
769 const GURL& url, | 769 const GURL& url, |
| 770 const std::string& method, |
770 int load_flags, | 771 int load_flags, |
771 ProxyDelegate* proxy_delegate, | 772 ProxyDelegate* proxy_delegate, |
772 ProxyInfo* results, | 773 ProxyInfo* results, |
773 const CompletionCallback& user_callback, | 774 const CompletionCallback& user_callback, |
774 const BoundNetLog& net_log) | 775 const BoundNetLog& net_log) |
775 : service_(service), | 776 : service_(service), |
776 user_callback_(user_callback), | 777 user_callback_(user_callback), |
777 results_(results), | 778 results_(results), |
778 url_(url), | 779 url_(url), |
| 780 method_(method), |
779 load_flags_(load_flags), | 781 load_flags_(load_flags), |
780 proxy_delegate_(proxy_delegate), | 782 proxy_delegate_(proxy_delegate), |
781 resolve_job_(NULL), | 783 resolve_job_(NULL), |
782 config_id_(ProxyConfig::kInvalidConfigID), | 784 config_id_(ProxyConfig::kInvalidConfigID), |
783 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), | 785 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), |
784 net_log_(net_log), | 786 net_log_(net_log), |
785 creation_time_(TimeTicks::Now()) { | 787 creation_time_(TimeTicks::Now()) { |
786 DCHECK(!user_callback.is_null()); | 788 DCHECK(!user_callback.is_null()); |
787 } | 789 } |
788 | 790 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 | 852 |
851 // This state is cleared when resolve_job_ is set to nullptr below. | 853 // This state is cleared when resolve_job_ is set to nullptr below. |
852 bool script_executed = is_started(); | 854 bool script_executed = is_started(); |
853 | 855 |
854 // Clear |resolve_job_| so is_started() returns false while | 856 // Clear |resolve_job_| so is_started() returns false while |
855 // DidFinishResolvingProxy() runs. | 857 // DidFinishResolvingProxy() runs. |
856 resolve_job_ = nullptr; | 858 resolve_job_ = nullptr; |
857 | 859 |
858 // Note that DidFinishResolvingProxy might modify |results_|. | 860 // Note that DidFinishResolvingProxy might modify |results_|. |
859 int rv = service_->DidFinishResolvingProxy( | 861 int rv = service_->DidFinishResolvingProxy( |
860 url_, load_flags_, proxy_delegate_, results_, result_code, net_log_, | 862 url_, method_, load_flags_, proxy_delegate_, results_, result_code, |
861 creation_time_, script_executed); | 863 net_log_, creation_time_, script_executed); |
862 | 864 |
863 // Make a note in the results which configuration was in use at the | 865 // Make a note in the results which configuration was in use at the |
864 // time of the resolve. | 866 // time of the resolve. |
865 results_->config_id_ = config_id_; | 867 results_->config_id_ = config_id_; |
866 results_->config_source_ = config_source_; | 868 results_->config_source_ = config_source_; |
867 results_->did_use_pac_script_ = true; | 869 results_->did_use_pac_script_ = true; |
868 results_->proxy_resolve_start_time_ = creation_time_; | 870 results_->proxy_resolve_start_time_ = creation_time_; |
869 results_->proxy_resolve_end_time_ = TimeTicks::Now(); | 871 results_->proxy_resolve_end_time_ = TimeTicks::Now(); |
870 | 872 |
871 // Reset the state associated with in-progress-resolve. | 873 // Reset the state associated with in-progress-resolve. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 | 905 |
904 ProxyResolver* resolver() const { return service_->resolver_.get(); } | 906 ProxyResolver* resolver() const { return service_->resolver_.get(); } |
905 | 907 |
906 // Note that we don't hold a reference to the ProxyService. Outstanding | 908 // Note that we don't hold a reference to the ProxyService. Outstanding |
907 // requests are cancelled during ~ProxyService, so this is guaranteed | 909 // requests are cancelled during ~ProxyService, so this is guaranteed |
908 // to be valid throughout our lifetime. | 910 // to be valid throughout our lifetime. |
909 ProxyService* service_; | 911 ProxyService* service_; |
910 CompletionCallback user_callback_; | 912 CompletionCallback user_callback_; |
911 ProxyInfo* results_; | 913 ProxyInfo* results_; |
912 GURL url_; | 914 GURL url_; |
| 915 std::string method_; |
913 int load_flags_; | 916 int load_flags_; |
914 ProxyDelegate* proxy_delegate_; | 917 ProxyDelegate* proxy_delegate_; |
915 ProxyResolver::RequestHandle resolve_job_; | 918 ProxyResolver::RequestHandle resolve_job_; |
916 ProxyConfig::ID config_id_; // The config id when the resolve was started. | 919 ProxyConfig::ID config_id_; // The config id when the resolve was started. |
917 ProxyConfigSource config_source_; // The source of proxy settings. | 920 ProxyConfigSource config_source_; // The source of proxy settings. |
918 BoundNetLog net_log_; | 921 BoundNetLog net_log_; |
919 // Time when the request was created. Stored here rather than in |results_| | 922 // Time when the request was created. Stored here rather than in |results_| |
920 // because the time in |results_| will be cleared. | 923 // because the time in |results_| will be cleared. |
921 TimeTicks creation_time_; | 924 TimeTicks creation_time_; |
922 }; | 925 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 // ProxyResolver dependency we give it will never be used. | 1005 // ProxyResolver dependency we give it will never be used. |
1003 scoped_ptr<ProxyConfigService> proxy_config_service( | 1006 scoped_ptr<ProxyConfigService> proxy_config_service( |
1004 new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); | 1007 new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); |
1005 | 1008 |
1006 return make_scoped_ptr(new ProxyService( | 1009 return make_scoped_ptr(new ProxyService( |
1007 std::move(proxy_config_service), | 1010 std::move(proxy_config_service), |
1008 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); | 1011 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); |
1009 } | 1012 } |
1010 | 1013 |
1011 int ProxyService::ResolveProxy(const GURL& raw_url, | 1014 int ProxyService::ResolveProxy(const GURL& raw_url, |
| 1015 const std::string& method, |
1012 int load_flags, | 1016 int load_flags, |
1013 ProxyInfo* result, | 1017 ProxyInfo* result, |
1014 const CompletionCallback& callback, | 1018 const CompletionCallback& callback, |
1015 PacRequest** pac_request, | 1019 PacRequest** pac_request, |
1016 ProxyDelegate* proxy_delegate, | 1020 ProxyDelegate* proxy_delegate, |
1017 const BoundNetLog& net_log) { | 1021 const BoundNetLog& net_log) { |
1018 DCHECK(!callback.is_null()); | 1022 DCHECK(!callback.is_null()); |
1019 return ResolveProxyHelper(raw_url, load_flags, result, callback, pac_request, | 1023 return ResolveProxyHelper(raw_url, method, load_flags, result, callback, |
1020 proxy_delegate, net_log); | 1024 pac_request, proxy_delegate, net_log); |
1021 } | 1025 } |
1022 | 1026 |
1023 int ProxyService::ResolveProxyHelper(const GURL& raw_url, | 1027 int ProxyService::ResolveProxyHelper(const GURL& raw_url, |
| 1028 const std::string& method, |
1024 int load_flags, | 1029 int load_flags, |
1025 ProxyInfo* result, | 1030 ProxyInfo* result, |
1026 const CompletionCallback& callback, | 1031 const CompletionCallback& callback, |
1027 PacRequest** pac_request, | 1032 PacRequest** pac_request, |
1028 ProxyDelegate* proxy_delegate, | 1033 ProxyDelegate* proxy_delegate, |
1029 const BoundNetLog& net_log) { | 1034 const BoundNetLog& net_log) { |
1030 DCHECK(CalledOnValidThread()); | 1035 DCHECK(CalledOnValidThread()); |
1031 | 1036 |
1032 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); | 1037 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); |
1033 | 1038 |
1034 // Notify our polling-based dependencies that a resolve is taking place. | 1039 // Notify our polling-based dependencies that a resolve is taking place. |
1035 // This way they can schedule their polls in response to network activity. | 1040 // This way they can schedule their polls in response to network activity. |
1036 config_service_->OnLazyPoll(); | 1041 config_service_->OnLazyPoll(); |
1037 if (script_poller_.get()) | 1042 if (script_poller_.get()) |
1038 script_poller_->OnLazyPoll(); | 1043 script_poller_->OnLazyPoll(); |
1039 | 1044 |
1040 if (current_state_ == STATE_NONE) | 1045 if (current_state_ == STATE_NONE) |
1041 ApplyProxyConfigIfAvailable(); | 1046 ApplyProxyConfigIfAvailable(); |
1042 | 1047 |
1043 // Strip away any reference fragments and the username/password, as they | 1048 // Strip away any reference fragments and the username/password, as they |
1044 // are not relevant to proxy resolution. | 1049 // are not relevant to proxy resolution. |
1045 GURL url = SimplifyUrlForRequest(raw_url); | 1050 GURL url = SimplifyUrlForRequest(raw_url); |
1046 | 1051 |
1047 // Check if the request can be completed right away. (This is the case when | 1052 // Check if the request can be completed right away. (This is the case when |
1048 // using a direct connection for example). | 1053 // using a direct connection for example). |
1049 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); | 1054 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); |
1050 if (rv != ERR_IO_PENDING) { | 1055 if (rv != ERR_IO_PENDING) { |
1051 rv = DidFinishResolvingProxy( | 1056 rv = DidFinishResolvingProxy( |
1052 url, load_flags, proxy_delegate, result, rv, net_log, | 1057 url, method, load_flags, proxy_delegate, result, rv, net_log, |
1053 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); | 1058 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); |
1054 return rv; | 1059 return rv; |
1055 } | 1060 } |
1056 | 1061 |
1057 if (callback.is_null()) | 1062 if (callback.is_null()) |
1058 return ERR_IO_PENDING; | 1063 return ERR_IO_PENDING; |
1059 | 1064 |
1060 scoped_refptr<PacRequest> req(new PacRequest( | 1065 scoped_refptr<PacRequest> req(new PacRequest(this, url, method, load_flags, |
1061 this, url, load_flags, proxy_delegate, result, callback, net_log)); | 1066 proxy_delegate, result, callback, |
| 1067 net_log)); |
1062 | 1068 |
1063 if (current_state_ == STATE_READY) { | 1069 if (current_state_ == STATE_READY) { |
1064 // Start the resolve request. | 1070 // Start the resolve request. |
1065 rv = req->Start(); | 1071 rv = req->Start(); |
1066 if (rv != ERR_IO_PENDING) | 1072 if (rv != ERR_IO_PENDING) |
1067 return req->QueryDidComplete(rv); | 1073 return req->QueryDidComplete(rv); |
1068 } else { | 1074 } else { |
1069 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); | 1075 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); |
1070 } | 1076 } |
1071 | 1077 |
1072 DCHECK_EQ(ERR_IO_PENDING, rv); | 1078 DCHECK_EQ(ERR_IO_PENDING, rv); |
1073 DCHECK(!ContainsPendingRequest(req.get())); | 1079 DCHECK(!ContainsPendingRequest(req.get())); |
1074 pending_requests_.insert(req); | 1080 pending_requests_.insert(req); |
1075 | 1081 |
1076 // Completion will be notified through |callback|, unless the caller cancels | 1082 // Completion will be notified through |callback|, unless the caller cancels |
1077 // the request using |pac_request|. | 1083 // the request using |pac_request|. |
1078 if (pac_request) | 1084 if (pac_request) |
1079 *pac_request = req.get(); | 1085 *pac_request = req.get(); |
1080 return rv; // ERR_IO_PENDING | 1086 return rv; // ERR_IO_PENDING |
1081 } | 1087 } |
1082 | 1088 |
1083 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, | 1089 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, |
| 1090 const std::string& method, |
1084 int load_flags, | 1091 int load_flags, |
1085 ProxyInfo* result, | 1092 ProxyInfo* result, |
1086 ProxyDelegate* proxy_delegate, | 1093 ProxyDelegate* proxy_delegate, |
1087 const BoundNetLog& net_log) { | 1094 const BoundNetLog& net_log) { |
1088 CompletionCallback null_callback; | 1095 CompletionCallback null_callback; |
1089 return ResolveProxyHelper(raw_url, load_flags, result, null_callback, | 1096 return ResolveProxyHelper(raw_url, method, load_flags, result, null_callback, |
1090 nullptr /* pac_request*/, proxy_delegate, | 1097 nullptr /* pac_request*/, proxy_delegate, |
1091 net_log) == OK; | 1098 net_log) == OK; |
1092 } | 1099 } |
1093 | 1100 |
1094 int ProxyService::TryToCompleteSynchronously(const GURL& url, | 1101 int ProxyService::TryToCompleteSynchronously(const GURL& url, |
1095 int load_flags, | 1102 int load_flags, |
1096 ProxyDelegate* proxy_delegate, | 1103 ProxyDelegate* proxy_delegate, |
1097 ProxyInfo* result) { | 1104 ProxyInfo* result) { |
1098 DCHECK_NE(STATE_NONE, current_state_); | 1105 DCHECK_NE(STATE_NONE, current_state_); |
1099 | 1106 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 // due to ProxyScriptDeciderPoller. | 1246 // due to ProxyScriptDeciderPoller. |
1240 config_.set_id(fetched_config_.id()); | 1247 config_.set_id(fetched_config_.id()); |
1241 config_.set_source(fetched_config_.source()); | 1248 config_.set_source(fetched_config_.source()); |
1242 | 1249 |
1243 // Resume any requests which we had to defer until the PAC script was | 1250 // Resume any requests which we had to defer until the PAC script was |
1244 // downloaded. | 1251 // downloaded. |
1245 SetReady(); | 1252 SetReady(); |
1246 } | 1253 } |
1247 | 1254 |
1248 int ProxyService::ReconsiderProxyAfterError(const GURL& url, | 1255 int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
| 1256 const std::string& method, |
1249 int load_flags, | 1257 int load_flags, |
1250 int net_error, | 1258 int net_error, |
1251 ProxyInfo* result, | 1259 ProxyInfo* result, |
1252 const CompletionCallback& callback, | 1260 const CompletionCallback& callback, |
1253 PacRequest** pac_request, | 1261 PacRequest** pac_request, |
1254 ProxyDelegate* proxy_delegate, | 1262 ProxyDelegate* proxy_delegate, |
1255 const BoundNetLog& net_log) { | 1263 const BoundNetLog& net_log) { |
1256 DCHECK(CalledOnValidThread()); | 1264 DCHECK(CalledOnValidThread()); |
1257 | 1265 |
1258 // Check to see if we have a new config since ResolveProxy was called. We | 1266 // Check to see if we have a new config since ResolveProxy was called. We |
1259 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a | 1267 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a |
1260 // direct connection failed and we never tried the current config. | 1268 // direct connection failed and we never tried the current config. |
1261 | 1269 |
1262 DCHECK(result); | 1270 DCHECK(result); |
1263 bool re_resolve = result->config_id_ != config_.id(); | 1271 bool re_resolve = result->config_id_ != config_.id(); |
1264 | 1272 |
1265 if (re_resolve) { | 1273 if (re_resolve) { |
1266 // If we have a new config or the config was never tried, we delete the | 1274 // If we have a new config or the config was never tried, we delete the |
1267 // list of bad proxies and we try again. | 1275 // list of bad proxies and we try again. |
1268 proxy_retry_info_.clear(); | 1276 proxy_retry_info_.clear(); |
1269 return ResolveProxy(url, load_flags, result, callback, pac_request, | 1277 return ResolveProxy(url, method, load_flags, result, callback, pac_request, |
1270 proxy_delegate, net_log); | 1278 proxy_delegate, net_log); |
1271 } | 1279 } |
1272 | 1280 |
1273 DCHECK(!result->is_empty()); | 1281 DCHECK(!result->is_empty()); |
1274 ProxyServer bad_proxy = result->proxy_server(); | 1282 ProxyServer bad_proxy = result->proxy_server(); |
1275 | 1283 |
1276 // We don't have new proxy settings to try, try to fallback to the next proxy | 1284 // We don't have new proxy settings to try, try to fallback to the next proxy |
1277 // in the list. | 1285 // in the list. |
1278 bool did_fallback = result->Fallback(net_error, net_log); | 1286 bool did_fallback = result->Fallback(net_error, net_log); |
1279 | 1287 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 bool ProxyService::ContainsPendingRequest(PacRequest* req) { | 1348 bool ProxyService::ContainsPendingRequest(PacRequest* req) { |
1341 return pending_requests_.count(req) == 1; | 1349 return pending_requests_.count(req) == 1; |
1342 } | 1350 } |
1343 | 1351 |
1344 void ProxyService::RemovePendingRequest(PacRequest* req) { | 1352 void ProxyService::RemovePendingRequest(PacRequest* req) { |
1345 DCHECK(ContainsPendingRequest(req)); | 1353 DCHECK(ContainsPendingRequest(req)); |
1346 pending_requests_.erase(req); | 1354 pending_requests_.erase(req); |
1347 } | 1355 } |
1348 | 1356 |
1349 int ProxyService::DidFinishResolvingProxy(const GURL& url, | 1357 int ProxyService::DidFinishResolvingProxy(const GURL& url, |
| 1358 const std::string& method, |
1350 int load_flags, | 1359 int load_flags, |
1351 ProxyDelegate* proxy_delegate, | 1360 ProxyDelegate* proxy_delegate, |
1352 ProxyInfo* result, | 1361 ProxyInfo* result, |
1353 int result_code, | 1362 int result_code, |
1354 const BoundNetLog& net_log, | 1363 const BoundNetLog& net_log, |
1355 base::TimeTicks start_time, | 1364 base::TimeTicks start_time, |
1356 bool script_executed) { | 1365 bool script_executed) { |
1357 // Don't track any metrics if start_time is 0, which will happen when the user | 1366 // Don't track any metrics if start_time is 0, which will happen when the user |
1358 // calls |TryResolveProxySynchronously|. | 1367 // calls |TryResolveProxySynchronously|. |
1359 if (!start_time.is_null()) { | 1368 if (!start_time.is_null()) { |
1360 TimeDelta diff = TimeTicks::Now() - start_time; | 1369 TimeDelta diff = TimeTicks::Now() - start_time; |
1361 if (script_executed) { | 1370 if (script_executed) { |
1362 // This function "fixes" the result code, so make sure script terminated | 1371 // This function "fixes" the result code, so make sure script terminated |
1363 // errors are tracked. Only track result codes that were a result of | 1372 // errors are tracked. Only track result codes that were a result of |
1364 // script execution. | 1373 // script execution. |
1365 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", | 1374 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", |
1366 result_code == ERR_PAC_SCRIPT_TERMINATED); | 1375 result_code == ERR_PAC_SCRIPT_TERMINATED); |
1367 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", | 1376 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", |
1368 diff, base::TimeDelta::FromMicroseconds(100), | 1377 diff, base::TimeDelta::FromMicroseconds(100), |
1369 base::TimeDelta::FromSeconds(20), 50); | 1378 base::TimeDelta::FromSeconds(20), 50); |
1370 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", | 1379 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", |
1371 std::abs(result_code)); | 1380 std::abs(result_code)); |
1372 } | 1381 } |
1373 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", | 1382 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", |
1374 script_executed); | 1383 script_executed); |
1375 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, | 1384 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, |
1376 base::TimeDelta::FromMicroseconds(100), | 1385 base::TimeDelta::FromMicroseconds(100), |
1377 base::TimeDelta::FromSeconds(20), 50); | 1386 base::TimeDelta::FromSeconds(20), 50); |
1378 } | 1387 } |
| 1388 |
1379 // Log the result of the proxy resolution. | 1389 // Log the result of the proxy resolution. |
1380 if (result_code == OK) { | 1390 if (result_code == OK) { |
1381 // Allow the proxy delegate to interpose on the resolution decision, | 1391 // Allow the proxy delegate to interpose on the resolution decision, |
1382 // possibly modifying the ProxyInfo. | 1392 // possibly modifying the ProxyInfo. |
1383 if (proxy_delegate) | 1393 if (proxy_delegate) |
1384 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1394 proxy_delegate->OnResolveProxy(url, method, load_flags, *this, result); |
1385 | 1395 |
1386 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1396 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
1387 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1397 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
1388 | 1398 |
1389 // This check is done to only log the NetLog event when necessary, it's | 1399 // This check is done to only log the NetLog event when necessary, it's |
1390 // not a performance optimization. | 1400 // not a performance optimization. |
1391 if (!proxy_retry_info_.empty()) { | 1401 if (!proxy_retry_info_.empty()) { |
1392 result->DeprioritizeBadProxies(proxy_retry_info_); | 1402 result->DeprioritizeBadProxies(proxy_retry_info_); |
1393 net_log.AddEvent( | 1403 net_log.AddEvent( |
1394 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, | 1404 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, |
(...skipping 11 matching lines...) Expand all Loading... |
1406 // This implicit fall-back to direct matches Firefox 3.5 and | 1416 // This implicit fall-back to direct matches Firefox 3.5 and |
1407 // Internet Explorer 8. For more information, see: | 1417 // Internet Explorer 8. For more information, see: |
1408 // | 1418 // |
1409 // http://www.chromium.org/developers/design-documents/proxy-settings-fall
back | 1419 // http://www.chromium.org/developers/design-documents/proxy-settings-fall
back |
1410 result->UseDirect(); | 1420 result->UseDirect(); |
1411 result_code = OK; | 1421 result_code = OK; |
1412 | 1422 |
1413 // Allow the proxy delegate to interpose on the resolution decision, | 1423 // Allow the proxy delegate to interpose on the resolution decision, |
1414 // possibly modifying the ProxyInfo. | 1424 // possibly modifying the ProxyInfo. |
1415 if (proxy_delegate) | 1425 if (proxy_delegate) |
1416 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1426 proxy_delegate->OnResolveProxy(url, method, load_flags, *this, result); |
1417 } else { | 1427 } else { |
1418 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; | 1428 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; |
1419 } | 1429 } |
1420 if (reset_config) { | 1430 if (reset_config) { |
1421 ResetProxyConfig(false); | 1431 ResetProxyConfig(false); |
1422 // If the ProxyResolver crashed, force it to be re-initialized for the | 1432 // If the ProxyResolver crashed, force it to be re-initialized for the |
1423 // next request by resetting the proxy config. If there are other pending | 1433 // next request by resetting the proxy config. If there are other pending |
1424 // requests, trigger the recreation immediately so those requests retry. | 1434 // requests, trigger the recreation immediately so those requests retry. |
1425 if (pending_requests_.size() > 1) | 1435 if (pending_requests_.size() > 1) |
1426 ApplyProxyConfigIfAvailable(); | 1436 ApplyProxyConfigIfAvailable(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 State previous_state = ResetProxyConfig(false); | 1649 State previous_state = ResetProxyConfig(false); |
1640 if (previous_state != STATE_NONE) | 1650 if (previous_state != STATE_NONE) |
1641 ApplyProxyConfigIfAvailable(); | 1651 ApplyProxyConfigIfAvailable(); |
1642 } | 1652 } |
1643 | 1653 |
1644 void ProxyService::OnDNSChanged() { | 1654 void ProxyService::OnDNSChanged() { |
1645 OnIPAddressChanged(); | 1655 OnIPAddressChanged(); |
1646 } | 1656 } |
1647 | 1657 |
1648 } // namespace net | 1658 } // namespace net |
OLD | NEW |