mirror of
https://github.com/lovell/sharp.git
synced 2025-07-13 04:20:12 +02:00
Allow escaped proxy credentials (#2664)
This commit is contained in:
parent
ed5d753b89
commit
9c100830e0
@ -25,7 +25,7 @@ module.exports = function () {
|
|||||||
? tunnelAgent.httpsOverHttps
|
? tunnelAgent.httpsOverHttps
|
||||||
: tunnelAgent.httpsOverHttp;
|
: tunnelAgent.httpsOverHttp;
|
||||||
const proxyAuth = proxy.username && proxy.password
|
const proxyAuth = proxy.username && proxy.password
|
||||||
? `${proxy.username}:${proxy.password}`
|
? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`
|
||||||
: null;
|
: null;
|
||||||
return tunnel({
|
return tunnel({
|
||||||
proxy: {
|
proxy: {
|
||||||
|
@ -19,6 +19,17 @@ describe('HTTP agent', function () {
|
|||||||
assert.strictEqual(443, proxy.defaultPort);
|
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 () {
|
it('HTTP proxy without auth from npm_config_proxy', function () {
|
||||||
process.env.npm_config_proxy = 'http://plaintext:456';
|
process.env.npm_config_proxy = 'http://plaintext:456';
|
||||||
const proxy = agent();
|
const proxy = agent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user