tls: use kEmptyObject

PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
LiviaMedeiros authored and Michaël Zasso committed 2022-07-31 09:44:30 +02:00
1 parent 3fbc5e441c
commit 444d77391c
4 files changed
+16 -6

No files matched your search

+5 -1
View File
@@ -47,6 +47,10 @@ const {
},
} = internalBinding('constants');
const {
kEmptyObject,
} = require('internal/util');
const {
validateInteger,
} = require('internal/validators');
@@ -97,7 +101,7 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
}
function createSecureContext(options) {
if (!options) options = {};
if (!options) options = kEmptyObject;
const {
honorCipherOrder,
+4 -3
View File
@@ -40,7 +40,8 @@ const {
const {
assertCrypto,
deprecate
deprecate,
kEmptyObject,
} = require('internal/util');
assertCrypto();
@@ -1182,9 +1183,9 @@ function Server(options, listener) {
if (typeof options === 'function') {
listener = options;
options = {};
options = kEmptyObject;
} else if (options == null || typeof options === 'object') {
options = options || {};
options = options ?? kEmptyObject;
} else {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
+5 -1
View File
@@ -17,6 +17,10 @@ const {
},
} = require('internal/errors');
const {
kEmptyObject,
} = require('internal/util');
const {
isArrayBufferView,
} = require('internal/util/types');
@@ -117,7 +121,7 @@ function processCiphers(ciphers, name) {
return { cipherList, cipherSuites };
}
function configSecureContext(context, options = {}, name = 'options') {
function configSecureContext(context, options = kEmptyObject, name = 'options') {
validateObject(options, name);
const {
+2 -1
View File
@@ -1,6 +1,7 @@
'use strict';
const EventEmitter = require('events');
const { kEmptyObject } = require('internal/util');
const { Duplex } = require('stream');
const _tls_wrap = require('_tls_wrap');
const _tls_common = require('_tls_common');
@@ -57,7 +58,7 @@ class SecurePair extends EventEmitter {
isServer = false,
requestCert = !isServer,
rejectUnauthorized = false,
options = {}) {
options = kEmptyObject) {
super();
const { socket1, socket2 } = new DuplexPair();