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

Commit

Permalink
Respect NO_PROXY when downloading the binary
Browse files Browse the repository at this point in the history
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]: npm/npm@40afd6aaf34
[2]: npm/npm#7168
  • Loading branch information
xzyfer committed Sep 26, 2016
1 parent aec7049 commit c1ab159
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,25 @@ function getUserAgent() {
}

/**
* 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;
}

/**
Expand Down

0 comments on commit c1ab159

Please sign in to comment.