Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index ca3629ebcdcdb6361921b2daf14d0b1bd7acd984..c142a903ae3fc264f77f59be6d08d982b4872e57 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -552,6 +552,9 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url, |
| DCHECK_NE(config_.id(), ProxyConfig::INVALID_ID); |
| + if (config_.block_everything()) |
| + return ERR_PROXY_CONNECTION_FAILED; |
|
eroman
2011/04/26 21:47:17
Should use a more specific error code here.
battre
2011/04/27 17:02:58
Done.
|
| + |
| if (config_.HasAutomaticSettings()) |
| return ERR_IO_PENDING; // Must submit the request to the proxy resolver. |
| @@ -642,10 +645,17 @@ void ProxyService::OnInitProxyResolverComplete(int result) { |
| init_proxy_resolver_.reset(); |
| if (result != OK) { |
| - VLOG(1) << "Failed configuring with PAC script, falling-back to manual " |
| - "proxy servers."; |
| - config_ = fetched_config_; |
| - config_.ClearAutomaticSettings(); |
| + if (fetched_config_.pac_mandatory()) { |
| + VLOG(1) << "Failed configuring with mandatory PAC script, blocking all " |
| + "traffic."; |
| + config_ = fetched_config_; |
| + config_.set_block_everything(true); |
| + } else { |
| + VLOG(1) << "Failed configuring with PAC script, falling-back to manual " |
| + "proxy servers."; |
| + config_ = fetched_config_; |
| + config_.ClearAutomaticSettings(); |
| + } |
| } |
| config_.set_id(fetched_config_.id()); |
| @@ -723,15 +733,19 @@ int ProxyService::DidFinishResolvingProxy(ProxyInfo* result, |
| make_scoped_refptr(new NetLogIntegerParameter( |
| "net_error", result_code))); |
| - // Fall-back to direct when the proxy resolver fails. This corresponds |
| - // with a javascript runtime error in the PAC script. |
| - // |
| - // This implicit fall-back to direct matches Firefox 3.5 and |
| - // Internet Explorer 8. For more information, see: |
| - // |
| - // http://www.chromium.org/developers/design-documents/proxy-settings-fallback |
| - result->UseDirect(); |
| - result_code = OK; |
| + if (!config_.pac_mandatory()) { |
| + // Fall-back to direct when the proxy resolver fails. This corresponds |
| + // with a javascript runtime error in the PAC script. |
| + // |
| + // This implicit fall-back to direct matches Firefox 3.5 and |
| + // Internet Explorer 8. For more information, see: |
| + // |
| + // http://www.chromium.org/developers/design-documents/proxy-settings-fallback |
| + result->UseDirect(); |
| + result_code = OK; |
| + } else { |
| + result_code = ERR_PROXY_CONNECTION_FAILED; |
|
eroman
2011/04/26 21:47:17
Use a more specific error code.
battre
2011/04/27 17:02:58
Done.
|
| + } |
| } |
| net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL); |