adding support for kProxyPacUrl
This commit is contained in:
parent
681e868a5b
commit
ca09f32548
1 changed files with 13 additions and 4 deletions
|
@ -72,6 +72,9 @@ const char kNoProxyServer[] = "no-proxy-server";
|
||||||
// affects HTTP and HTTPS requests.
|
// affects HTTP and HTTPS requests.
|
||||||
const char kProxyServer[] = "proxy-server";
|
const char kProxyServer[] = "proxy-server";
|
||||||
|
|
||||||
|
// Uses the pac script at the given URL.
|
||||||
|
const char kProxyPacUrl[] = "proxy-pac-url";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
|
net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
|
||||||
|
@ -183,12 +186,18 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
|
|
||||||
// --proxy-server
|
// --proxy-server
|
||||||
net::DhcpProxyScriptFetcherFactory dhcp_factory;
|
net::DhcpProxyScriptFetcherFactory dhcp_factory;
|
||||||
if (command_line.HasSwitch(kNoProxyServer))
|
if (command_line.HasSwitch(kNoProxyServer)) {
|
||||||
storage_->set_proxy_service(net::ProxyService::CreateDirect());
|
storage_->set_proxy_service(net::ProxyService::CreateDirect());
|
||||||
else if (command_line.HasSwitch(kProxyServer))
|
} else if (command_line.HasSwitch(kProxyServer)) {
|
||||||
storage_->set_proxy_service(net::ProxyService::CreateFixed(
|
storage_->set_proxy_service(net::ProxyService::CreateFixed(
|
||||||
command_line.GetSwitchValueASCII(kProxyServer)));
|
command_line.GetSwitchValueASCII(kProxyServer)));
|
||||||
else
|
} else if (command_line.HasSwitch(kProxyPacUrl)) {
|
||||||
|
auto proxy_config = net::ProxyConfig::CreateFromCustomPacURL(
|
||||||
|
GURL(command_line.GetSwitchValueASCII(kProxyPacUrl)));
|
||||||
|
proxy_config.set_pac_mandatory(true);
|
||||||
|
storage_->set_proxy_service(net::ProxyService::CreateFixed(
|
||||||
|
proxy_config));
|
||||||
|
} else {
|
||||||
storage_->set_proxy_service(
|
storage_->set_proxy_service(
|
||||||
net::CreateProxyServiceUsingV8ProxyResolver(
|
net::CreateProxyServiceUsingV8ProxyResolver(
|
||||||
proxy_config_service_.release(),
|
proxy_config_service_.release(),
|
||||||
|
@ -197,7 +206,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
host_resolver.get(),
|
host_resolver.get(),
|
||||||
NULL,
|
NULL,
|
||||||
url_request_context_->network_delegate()));
|
url_request_context_->network_delegate()));
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> schemes;
|
std::vector<std::string> schemes;
|
||||||
schemes.push_back(std::string("basic"));
|
schemes.push_back(std::string("basic"));
|
||||||
|
|
Loading…
Reference in a new issue