From 16e0d54b15f4960a82a22316a0daf065c7f7a5f3 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 3 Dec 2015 21:30:47 +0000 Subject: [PATCH] Use the NPM-configured HTTPS proxy, if present --- binding.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/binding.js b/binding.js index 7795f42b..fc843595 100644 --- a/binding.js +++ b/binding.js @@ -77,7 +77,14 @@ module.exports.download_vips = function() { var tmpFile = fs.createWriteStream(tarPath).on('finish', function() { unpack(tarPath); }); - request(distBaseUrl + tarFilename).on('response', function(response) { + var options = { + url: distBaseUrl + tarFilename + }; + if (process.env.npm_config_https_proxy) { + // Use the NPM-configured HTTPS proxy + options.proxy = process.env.npm_config_https_proxy; + } + request(options).on('response', function(response) { if (response.statusCode !== 200) { error(distBaseUrl + tarFilename + ' status code ' + response.statusCode); }