diff --git a/src/typings/http-proxy-agent.d.ts b/src/typings/http-proxy-agent.d.ts index ffd3e0185900d0585e8eeee5e0c1663a6be54f56..3d0071543b488067fe42c5a87cd645fb1f3296d7 100644 --- a/src/typings/http-proxy-agent.d.ts +++ b/src/typings/http-proxy-agent.d.ts @@ -5,8 +5,16 @@ declare module 'http-proxy-agent' { + interface IHttpProxyAgentOptions { + host: string; + port: number; + auth?: string; + } + class HttpProxyAgent { constructor(proxy: string); + constructor(opts: IHttpProxyAgentOptions); } + export = HttpProxyAgent; } \ No newline at end of file diff --git a/src/typings/https-proxy-agent.d.ts b/src/typings/https-proxy-agent.d.ts index b4be3e030b58b4b0ac0689c282e8289710a59c0a..384bee1d6c59f80894e1f2e70971ca88edff4ee7 100644 --- a/src/typings/https-proxy-agent.d.ts +++ b/src/typings/https-proxy-agent.d.ts @@ -10,6 +10,7 @@ declare module 'https-proxy-agent' { interface IHttpsProxyAgentOptions extends tls.ConnectionOptions { host: string; port: number; + auth?: string; secureProxy?: boolean; secureEndpoint?: boolean; } diff --git a/src/vs/base/node/proxy.ts b/src/vs/base/node/proxy.ts index 69940e0bacb0f4d883648aa6acd29d8aadd39fd4..3a0ab3673294c3c802b55da165b020b4e542bd28 100644 --- a/src/vs/base/node/proxy.ts +++ b/src/vs/base/node/proxy.ts @@ -7,6 +7,7 @@ import { Url, parse as parseUrl } from 'url'; import { isBoolean } from 'vs/base/common/types'; +import { assign } from 'vs/base/common/objects'; import HttpProxyAgent = require('http-proxy-agent'); import HttpsProxyAgent = require('https-proxy-agent'); @@ -39,13 +40,12 @@ export function getProxyAgent(rawRequestURL: string, options: IOptions = {}): an return null; } - if (requestURL.protocol === 'http:') { - return new HttpProxyAgent(proxyURL); - } - - return new HttpsProxyAgent({ + const opts = { host: proxyEndpoint.hostname, port: Number(proxyEndpoint.port), + auth: proxyEndpoint.auth, rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true - }); + }; + + return requestURL.protocol === 'http:' ? new HttpProxyAgent(opts) : new HttpsProxyAgent(opts); } \ No newline at end of file