Skip to content

Commit 83575d5

Browse files
committedApr 26, 2021
Enable more HTTPS options
Related with #1306 TODO: tests
1 parent e830077 commit 83575d5

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
 

‎source/core/options.ts

+42-1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,16 @@ export interface HttpsOptions {
360360
*/
361361
passphrase?: SecureContextOptions['passphrase'];
362362
pfx?: SecureContextOptions['pfx'];
363+
364+
ciphers?: SecureContextOptions['ciphers'];
365+
honorCipherOrder?: SecureContextOptions['honorCipherOrder'];
366+
minVersion?: SecureContextOptions['minVersion'];
367+
maxVersion?: SecureContextOptions['maxVersion'];
368+
signatureAlgorithms?: SecureContextOptions['sigalgs'];
369+
tlsSessionLifetime?: SecureContextOptions['sessionTimeout'];
370+
dhparam?: SecureContextOptions['dhparam'];
371+
ecdhCurve?: SecureContextOptions['ecdhCurve'];
372+
certificateRevocationLists?: SecureContextOptions['crl'];
363373
}
364374

365375
export interface PaginateData<BodyType, ElementType> {
@@ -639,7 +649,16 @@ const defaultInternals: Options['_internals'] = {
639649
key: undefined,
640650
certificate: undefined,
641651
passphrase: undefined,
642-
pfx: undefined
652+
pfx: undefined,
653+
ciphers: undefined,
654+
honorCipherOrder: undefined,
655+
minVersion: undefined,
656+
maxVersion: undefined,
657+
signatureAlgorithms: undefined,
658+
tlsSessionLifetime: undefined,
659+
dhparam: undefined,
660+
ecdhCurve: undefined,
661+
certificateRevocationLists: undefined
643662
},
644663
encoding: undefined,
645664
resolveBodyOnly: false,
@@ -1900,6 +1919,15 @@ export default class Options {
19001919
assert.any([is.string, is.undefined], value.passphrase);
19011920
assert.any([is.string, is.buffer, is.array, is.undefined], value.pfx);
19021921
assert.any([is.array, is.undefined], value.alpnProtocols);
1922+
assert.any([is.string, is.undefined], value.ciphers);
1923+
assert.any([is.string, is.buffer, is.undefined], value.dhparam);
1924+
assert.any([is.string, is.undefined], value.signatureAlgorithms);
1925+
assert.any([is.string, is.undefined], value.minVersion);
1926+
assert.any([is.string, is.undefined], value.maxVersion);
1927+
assert.any([is.boolean, is.undefined], value.honorCipherOrder);
1928+
assert.any([is.number, is.undefined], value.tlsSessionLifetime);
1929+
assert.any([is.string, is.undefined], value.ecdhCurve);
1930+
assert.any([is.string, is.buffer, is.array, is.undefined], value.certificateRevocationLists);
19031931

19041932
for (const key in value) {
19051933
if (!(key in this._internals.httpsOptions)) {
@@ -2082,13 +2110,26 @@ export default class Options {
20822110
return {
20832111
...internals.cacheOptions,
20842112
...this._unixOptions,
2113+
2114+
// HTTPS options
20852115
ca: httpsOptions.certificateAuthority,
20862116
cert: httpsOptions.certificate,
20872117
key: httpsOptions.key,
20882118
passphrase: httpsOptions.passphrase,
20892119
pfx: httpsOptions.pfx,
20902120
rejectUnauthorized: httpsOptions.rejectUnauthorized,
20912121
checkServerIdentity: httpsOptions.checkServerIdentity ?? checkServerIdentity,
2122+
ciphers: httpsOptions.ciphers,
2123+
honorCipherOrder: httpsOptions.honorCipherOrder,
2124+
minVersion: httpsOptions.minVersion,
2125+
maxVersion: httpsOptions.maxVersion,
2126+
sigalgs: httpsOptions.signatureAlgorithms,
2127+
sessionTimeout: httpsOptions.tlsSessionLifetime,
2128+
dhparam: httpsOptions.dhparam,
2129+
ecdhCurve: httpsOptions.ecdhCurve,
2130+
crl: httpsOptions.certificateRevocationLists,
2131+
2132+
// HTTP options
20922133
lookup: internals.dnsLookup ?? (internals.dnsCache as CacheableLookup | undefined)?.lookup,
20932134
family: internals.dnsLookupIpVersion,
20942135
agent,

‎test/arguments.ts

+3
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ test('prefixUrl is properly replaced when extending', withServer, async (t, serv
559559
});
560560

561561
test('throws on too large noise', t => {
562+
/* eslint-disable no-new */
562563
t.throws(() => {
563564
new Options({
564565
retry: {
@@ -606,4 +607,6 @@ test('throws on too large noise', t => {
606607
}
607608
});
608609
});
610+
611+
/* eslint-enable no-new */
609612
});

0 commit comments

Comments
 (0)
Please sign in to comment.