mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
04c68ba54a
PR-URL: https://github.com/nodejs/node/pull/41906 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
|
|
const agent = new https.Agent();
|
|
|
|
// empty argument
|
|
assert.strictEqual(
|
|
agent.getName(),
|
|
'localhost::::::::::::::::::::::'
|
|
);
|
|
|
|
// empty options
|
|
assert.strictEqual(
|
|
agent.getName({}),
|
|
'localhost::::::::::::::::::::::'
|
|
);
|
|
|
|
// Pass all options arguments
|
|
const options = {
|
|
host: '0.0.0.0',
|
|
port: 443,
|
|
localAddress: '192.168.1.1',
|
|
ca: 'ca',
|
|
cert: 'cert',
|
|
clientCertEngine: 'dynamic',
|
|
ciphers: 'ciphers',
|
|
crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')],
|
|
dhparam: 'dhparam',
|
|
ecdhCurve: 'ecdhCurve',
|
|
honorCipherOrder: false,
|
|
key: 'key',
|
|
pfx: 'pfx',
|
|
rejectUnauthorized: false,
|
|
secureOptions: 0,
|
|
secureProtocol: 'secureProtocol',
|
|
servername: 'localhost',
|
|
sessionIdContext: 'sessionIdContext',
|
|
sigalgs: 'sigalgs',
|
|
privateKeyIdentifier: 'privateKeyIdentifier',
|
|
privateKeyEngine: 'privateKeyEngine',
|
|
};
|
|
|
|
assert.strictEqual(
|
|
agent.getName(options),
|
|
'0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' +
|
|
'::secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext:' +
|
|
'"sigalgs":privateKeyIdentifier:privateKeyEngine'
|
|
);
|