Skip to content

Commit

Permalink
Merge pull request #932 from OmniSharp/master
Browse files Browse the repository at this point in the history
Merge fix for #930 into release
  • Loading branch information
DustinCampbell authored Nov 14, 2016
2 parents 5f817ff + 3e996e3 commit 6cbef87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function getNoopStatus(): Status {
};
}

function downloadPackage(pkg: Package, logger: Logger, status?: Status, proxy?: string, strictSSL?: boolean): Promise<void> {
function downloadPackage(pkg: Package, logger: Logger, status: Status, proxy: string, strictSSL: boolean): Promise<void> {
status = status || getNoopStatus();

logger.append(`Downloading package '${pkg.description}' `);
Expand All @@ -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<void> {
function downloadFile(urlString: string, pkg: Package, logger: Logger, status: Status, proxy: string, strictSSL: boolean): Promise<void> {
const url = parseUrl(urlString);

const options: https.RequestOptions = {
Expand All @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 6cbef87

Please sign in to comment.