2016-05-14 15:08:12 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-05-30 01:45:20 +02:00
|
|
|
const common = require('../common');
|
2017-07-01 02:29:09 +03:00
|
|
|
if (!common.hasCrypto)
|
2016-05-30 01:45:20 +02:00
|
|
|
common.skip('missing crypto');
|
|
|
|
|
|
2016-05-14 15:08:12 -04:00
|
|
|
const assert = require('assert');
|
|
|
|
|
const https = require('https');
|
|
|
|
|
|
|
|
|
|
const agent = new https.Agent();
|
|
|
|
|
|
|
|
|
|
// empty options
|
|
|
|
|
assert.strictEqual(
|
|
|
|
|
agent.getName({}),
|
2018-05-06 13:52:34 +09:00
|
|
|
'localhost:::::::::::::::::::'
|
2016-05-14 15:08:12 -04:00
|
|
|
);
|
|
|
|
|
|
2019-03-22 03:44:26 +01:00
|
|
|
// Pass all options arguments
|
2016-05-14 15:08:12 -04:00
|
|
|
const options = {
|
|
|
|
|
host: '0.0.0.0',
|
|
|
|
|
port: 443,
|
|
|
|
|
localAddress: '192.168.1.1',
|
|
|
|
|
ca: 'ca',
|
|
|
|
|
cert: 'cert',
|
2018-11-08 15:04:09 +01:00
|
|
|
clientCertEngine: 'dynamic',
|
2016-05-14 15:08:12 -04:00
|
|
|
ciphers: 'ciphers',
|
2017-10-16 21:23:29 -07:00
|
|
|
crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')],
|
|
|
|
|
dhparam: 'dhparam',
|
|
|
|
|
ecdhCurve: 'ecdhCurve',
|
|
|
|
|
honorCipherOrder: false,
|
2016-05-14 15:08:12 -04:00
|
|
|
key: 'key',
|
|
|
|
|
pfx: 'pfx',
|
|
|
|
|
rejectUnauthorized: false,
|
2017-10-16 21:23:29 -07:00
|
|
|
secureOptions: 0,
|
|
|
|
|
secureProtocol: 'secureProtocol',
|
2016-05-14 15:08:12 -04:00
|
|
|
servername: 'localhost',
|
2017-10-16 21:23:29 -07:00
|
|
|
sessionIdContext: 'sessionIdContext'
|
2016-05-14 15:08:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
assert.strictEqual(
|
|
|
|
|
agent.getName(options),
|
2018-11-08 15:04:09 +01:00
|
|
|
'0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' +
|
2018-05-06 13:52:34 +09:00
|
|
|
'::secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext'
|
2016-05-14 15:08:12 -04:00
|
|
|
);
|