提交 17682edf 编写于 作者: J Joao Moreno

use auth in proxies

related to #1942
上级 5273e353
......@@ -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
......@@ -10,6 +10,7 @@ declare module 'https-proxy-agent' {
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
host: string;
port: number;
auth?: string;
secureProxy?: boolean;
secureEndpoint?: boolean;
}
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册