Make extension respect http proxy settings

This commit is contained in:
Kam Y. Tse 2021-03-07 17:55:43 +08:00
parent f0b7c02f16
commit 77b7c96aea
No known key found for this signature in database
GPG key ID: FD2B87915048AB4F
5 changed files with 42 additions and 15 deletions

View file

@ -183,7 +183,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
}
const release = await downloadWithRetryDialog(state, async () => {
return await fetchRelease("nightly", state.githubToken);
return await fetchRelease("nightly", state.githubToken, config.httpProxy);
}).catch(async (e) => {
log.error(e);
if (state.releaseId === undefined) { // Show error only for the initial download
@ -209,6 +209,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
url: artifact.browser_download_url,
dest,
progressTitle: "Downloading rust-analyzer extension",
httpProxy: config.httpProxy,
});
});
@ -331,7 +332,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
const releaseTag = config.package.releaseTag;
const release = await downloadWithRetryDialog(state, async () => {
return await fetchRelease(releaseTag, state.githubToken);
return await fetchRelease(releaseTag, state.githubToken, config.httpProxy);
});
const artifact = release.assets.find(artifact => artifact.name === `rust-analyzer-${platform}.gz`);
assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
@ -343,6 +344,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
progressTitle: "Downloading rust-analyzer server",
gunzip: true,
mode: 0o755,
httpProxy: config.httpProxy,
});
});