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

Unified Diff: net/proxy/proxy_service.cc

Issue 6871019: Enable (optional) blocking of webrequests in case a PAC script cannot be fetched or is invalid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 8 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
« net/proxy/proxy_config.cc ('K') | « net/proxy/proxy_config.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« net/proxy/proxy_config.cc ('K') | « net/proxy/proxy_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698