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

Commit

Permalink
Merge pull request #123 from deepak1556/proxy_patch
Browse files Browse the repository at this point in the history
adding support for kProxyPacUrl
  • Loading branch information
zcbenz committed Jul 13, 2015
2 parents e0c977c + 662588f commit 6a38d97
Showing 1 changed file with 13 additions and 4 deletions.
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

0 comments on commit 6a38d97

Please sign in to comment.