mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Pass HTTPS client parameters.
For more detailed control over HTTPS client behaviour, pass through the parameters listed here: http://nodejs.org/api/https.html#https_https_request_options_callback The `rejectUnauthorized` parameter is omitted, because it overlaps with the existing `secure` parameter: https://github.com/nodejitsu/node-http-proxy/blob/master/README.md#using-https Conflicts: test/lib-http-proxy-common-test.js
This commit is contained in:
parent
f0db5b3f70
commit
402ab05734
@ -34,7 +34,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
|
||||
outgoing.port = options[forward || 'target'].port ||
|
||||
(isSSL.test(options[forward || 'target'].protocol) ? 443 : 80);
|
||||
|
||||
['host', 'hostname', 'socketPath'].forEach(
|
||||
['host', 'hostname', 'socketPath', 'pfx', 'key',
|
||||
'passphrase', 'cert', 'ca', 'ciphers', 'secureProtocol'].forEach(
|
||||
function(e) { outgoing[e] = options[forward || 'target'][e]; }
|
||||
);
|
||||
|
||||
|
||||
@ -250,6 +250,7 @@ describe('lib/http-proxy/common.js', function () {
|
||||
|
||||
expect(outgoing.headers.host).to.eql('mycouch.com:6984');
|
||||
});
|
||||
|
||||
it('should correctly set the port to the host when it is a non-standard port when setting host and port manually (which ignores port)', function () {
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing, {
|
||||
@ -264,6 +265,38 @@ describe('lib/http-proxy/common.js', function () {
|
||||
})
|
||||
});
|
||||
|
||||
it('should pass through https client parameters', function () {
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing,
|
||||
{
|
||||
agent : '?',
|
||||
target: {
|
||||
host : 'how',
|
||||
hostname : 'are',
|
||||
socketPath: 'you',
|
||||
protocol: 'https:',
|
||||
pfx: 'my-pfx',
|
||||
key: 'my-key',
|
||||
passphrase: 'my-passphrase',
|
||||
cert: 'my-cert',
|
||||
ca: 'my-ca',
|
||||
ciphers: 'my-ciphers',
|
||||
secureProtocol: 'my-secure-protocol'
|
||||
}
|
||||
},
|
||||
{
|
||||
method : 'i',
|
||||
url : 'am'
|
||||
});
|
||||
|
||||
expect(outgoing.pfx).eql('my-pfx');
|
||||
expect(outgoing.key).eql('my-key');
|
||||
expect(outgoing.passphrase).eql('my-passphrase');
|
||||
expect(outgoing.cert).eql('my-cert');
|
||||
expect(outgoing.ca).eql('my-ca');
|
||||
expect(outgoing.ciphers).eql('my-ciphers');
|
||||
expect(outgoing.secureProtocol).eql('my-secure-protocol');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setupSocket', function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user