[fix] fixed issue with double http prepending on http proxy (#889)

This commit is contained in:
silentrald
2025-06-21 19:54:04 +08:00
committed by GitHub
parent c6500f7cf6
commit 06c242eb01
+9 -1
View File
@@ -51,7 +51,15 @@ async function enableWindowsProxy(enable: boolean): Promise<void> {
}
if (enable) {
const httpProxyUrl = `http://${await getProxyServer().catch(err => log.error(err))}`
const httpProxyServer = await getProxyServer().catch(err => log.error(err));
let httpProxyUrl: string | null = null;
if (httpProxyServer) {
// Prepend the http protocol
httpProxyUrl = httpProxyServer.startsWith("http://")
? httpProxyServer
: `http://${httpProxyServer}`;
}
globalProxyAgent.HTTP_PROXY = httpProxyUrl;
globalProxyAgent.HTTPS_PROXY = httpProxyUrl;
globalProxyAgent.NO_PROXY = `${await getProxyOverride().catch(err => log.error(err))}`;