Commit 3a4e9c6c by xzyfer

Respect NO_PROXY when downloading the binary

Turns our handling proxies is complicated. The sanest thing to do
is try matching [npm's behaviour][1], and liable [to change][1] to
our benefit. The TLDR; of which is to let `request` do whatever
it wants unless npm has been explicitly configured otherwise.

Fixes #1724

[1]: https://github.com/npm/npm/commit/40afd6aaf34
[2]: https://github.com/npm/npm/issues/7168
parent bd6d7a35
......@@ -96,21 +96,25 @@ function download(url, dest, cb) {
}
/**
* Determine local proxy settings
* Determine the proxy settings configured by npm
*
* @param {Object} options
* @param {Function} cb
* It's possible to configure npm to use a proxy different
* from the system defined proxy. This can be done via the
* `npm config` CLI or the `.npmrc` config file.
*
* If a proxy has been configured in this way we must
* tell request explicitly to use it.
*
* Otherwise we can trust request to the right thing.
*
* @return {String} the proxy configured by npm or an empty string
* @api private
*/
function getProxy() {
return process.env.npm_config_https_proxy ||
process.env.npm_config_proxy ||
process.env.npm_config_http_proxy ||
process.env.HTTPS_PROXY ||
process.env.https_proxy ||
process.env.HTTP_PROXY ||
process.env.http_proxy;
return '' ||
process.env.npm_config_https_proxy ||
process.env.npm_config_proxy ||
process.env.npm_config_http_proxy;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment