Add --no-proxy-server switch.

This commit is contained in:
Cheng Zhao 2014-08-20 11:44:45 +08:00
parent 59398bc24b
commit d136c44792

View file

@ -61,7 +61,11 @@ namespace {
// These mappings apply to the endpoint host in a net::URLRequest (the TCP // These mappings apply to the endpoint host in a net::URLRequest (the TCP
// connect and host resolver in a direct connection, and the CONNECT in an http // connect and host resolver in a direct connection, and the CONNECT in an http
// proxy connection, and the endpoint host in a SOCKS proxy connection). // proxy connection, and the endpoint host in a SOCKS proxy connection).
const char kHostRules[] = "host-rules"; const char kHostRules[] = "host-rules";
// Don't use a proxy server, always make direct connections. Overrides any
// other proxy server flags that are passed.
const char kNoProxyServer[] = "no-proxy-server";
} // namespace } // namespace
@ -132,14 +136,17 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} }
net::DhcpProxyScriptFetcherFactory dhcp_factory; net::DhcpProxyScriptFetcherFactory dhcp_factory;
storage_->set_proxy_service( if (command_line.HasSwitch(kNoProxyServer))
net::CreateProxyServiceUsingV8ProxyResolver( storage_->set_proxy_service(net::ProxyService::CreateDirect());
proxy_config_service_.release(), else
new net::ProxyScriptFetcherImpl(url_request_context_.get()), storage_->set_proxy_service(
dhcp_factory.Create(url_request_context_.get()), net::CreateProxyServiceUsingV8ProxyResolver(
host_resolver.get(), proxy_config_service_.release(),
NULL, new net::ProxyScriptFetcherImpl(url_request_context_.get()),
url_request_context_->network_delegate())); dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(),
NULL,
url_request_context_->network_delegate()));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
storage_->set_transport_security_state(new net::TransportSecurityState); storage_->set_transport_security_state(new net::TransportSecurityState);