Allow escaped proxy credentials (#2664)

This commit is contained in:
msalettes
2021-04-17 09:49:07 +02:00
committed by GitHub
parent ed5d753b89
commit 9c100830e0
2 changed files with 12 additions and 1 deletions

View File

@@ -19,6 +19,17 @@ describe('HTTP agent', function () {
assert.strictEqual(443, proxy.defaultPort);
});
it('HTTPS proxy with auth from HTTPS_PROXY using credentials containing special characters', function () {
process.env.HTTPS_PROXY = 'https://user,:pass=@secure:123';
const proxy = agent();
delete process.env.HTTPS_PROXY;
assert.strictEqual('object', typeof proxy);
assert.strictEqual('secure', proxy.options.proxy.host);
assert.strictEqual(123, proxy.options.proxy.port);
assert.strictEqual('user,:pass=', proxy.options.proxy.proxyAuth);
assert.strictEqual(443, proxy.defaultPort);
});
it('HTTP proxy without auth from npm_config_proxy', function () {
process.env.npm_config_proxy = 'http://plaintext:456';
const proxy = agent();