diff --git a/src/packages.ts b/src/packages.ts index 731038565..7201b58a7 100644 --- a/src/packages.ts +++ b/src/packages.ts @@ -128,7 +128,7 @@ function getNoopStatus(): Status { }; } -function downloadPackage(pkg: Package, logger: Logger, status?: Status, proxy?: string, strictSSL?: boolean): Promise { +function downloadPackage(pkg: Package, logger: Logger, status: Status, proxy: string, strictSSL: boolean): Promise { status = status || getNoopStatus(); logger.append(`Downloading package '${pkg.description}' `); @@ -147,12 +147,12 @@ function downloadPackage(pkg: Package, logger: Logger, status?: Status, proxy?: }).then(tmpResult => { pkg.tmpFile = tmpResult; - return downloadFile(pkg.url, pkg, logger, status) + return downloadFile(pkg.url, pkg, logger, status, proxy, strictSSL) .then(() => logger.appendLine(' Done!')); }); } -function downloadFile(urlString: string, pkg: Package, logger: Logger, status: Status, proxy?: string, strictSSL?: boolean): Promise { +function downloadFile(urlString: string, pkg: Package, logger: Logger, status: Status, proxy: string, strictSSL: boolean): Promise { const url = parseUrl(urlString); const options: https.RequestOptions = { @@ -169,7 +169,7 @@ function downloadFile(urlString: string, pkg: Package, logger: Logger, status: S let request = https.request(options, response => { if (response.statusCode === 301 || response.statusCode === 302) { // Redirect - download from new location - return resolve(downloadFile(response.headers.location, pkg, logger, status)); + return resolve(downloadFile(response.headers.location, pkg, logger, status, proxy, strictSSL)); } if (response.statusCode != 200) { diff --git a/src/proxy.ts b/src/proxy.ts index 611a7476f..cef80c242 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -19,7 +19,7 @@ function getSystemProxyURL(requestURL: Url): string { return null; } -export function getProxyAgent(requestURL: Url, proxy?: string, strictSSL?: boolean): any { +export function getProxyAgent(requestURL: Url, proxy: string, strictSSL: boolean): any { const proxyURL = proxy || getSystemProxyURL(requestURL); if (!proxyURL) { @@ -32,7 +32,9 @@ export function getProxyAgent(requestURL: Url, proxy?: string, strictSSL?: boole return null; } - strictSSL = strictSSL || true; + if (strictSSL === undefined) { + strictSSL = true; + } const opts = { host: proxyEndpoint.hostname,