mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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:
1 parent
3fbc5e441c
commit
444d77391c
4 files changed
+16
-6
No files matched your search
+5
-1
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user