Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

adding support for kProxyPacUrl #123

Merged
merged 1 commit into from
Jul 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions browser/url_request_context_getter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const char kNoProxyServer[] = "no-proxy-server";
// affects HTTP and HTTPS requests.
const char kProxyServer[] = "proxy-server";

// Uses the pac script at the given URL.
const char kProxyPacUrl[] = "proxy-pac-url";

} // namespace

net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
Expand Down Expand Up @@ -183,12 +186,18 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {

// --proxy-server
net::DhcpProxyScriptFetcherFactory dhcp_factory;
if (command_line.HasSwitch(kNoProxyServer))
if (command_line.HasSwitch(kNoProxyServer)) {
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(
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(
net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.release(),
Expand All @@ -197,7 +206,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
host_resolver.get(),
NULL,
url_request_context_->network_delegate()));

}

std::vector<std::string> schemes;
schemes.push_back(std::string("basic"));
Expand Down