Commit e9b69ab6 by Adeel Mujahid

Merge pull request #567 from cuongvo/master

Added 'rejectUnauthorized' to support self-signed TLS certificates
parents 604e206d 19fa6690
...@@ -15,7 +15,7 @@ var fs = require('fs'), ...@@ -15,7 +15,7 @@ var fs = require('fs'),
function download(url, dest, cb) { function download(url, dest, cb) {
var file = fs.createWriteStream(dest); var file = fs.createWriteStream(dest);
var options = { proxy: getProxy() }; var options = { proxy: getProxy(), rejectUnauthorized: false };
var returnError = function(err) { var returnError = function(err) {
fs.unlink(dest); fs.unlink(dest);
cb(typeof err.message === 'string' ? err.message : err); cb(typeof err.message === 'string' ? err.message : err);
...@@ -34,7 +34,7 @@ function download(url, dest, cb) { ...@@ -34,7 +34,7 @@ function download(url, dest, cb) {
req.end(); req.end();
req.on('error', returnError); req.on('error', returnError);
}; }
/** /**
* Get proxy settings * Get proxy settings
...@@ -60,7 +60,7 @@ function getProxy() { ...@@ -60,7 +60,7 @@ function getProxy() {
} }
var env = process.env; var env = process.env;
return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.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