From 0443f11fa60da3b0bf9ebe683c96b0647b0d5ca5 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 16 Apr 2018 14:59:51 +0200 Subject: [PATCH 1/2] lib: make c, ca and certs const in _tls_common --- lib/_tls_common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_tls_common.js b/lib/_tls_common.js index b669badb701106..16a892c4b6eda8 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -88,7 +88,7 @@ exports.createSecureContext = function createSecureContext(options, context) { if (options.honorCipherOrder) secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE; - var c = new SecureContext(options.secureProtocol, secureOptions, context); + const c = new SecureContext(options.secureProtocol, secureOptions, context); var i; var val; @@ -96,7 +96,7 @@ exports.createSecureContext = function createSecureContext(options, context) { // NOTE: It's important to add CA before the cert to be able to load // cert's issuer in C++ code. - var ca = options.ca; + const ca = options.ca; if (ca) { if (Array.isArray(ca)) { for (i = 0; i < ca.length; ++i) { @@ -112,7 +112,7 @@ exports.createSecureContext = function createSecureContext(options, context) { c.context.addRootCerts(); } - var cert = options.cert; + const cert = options.cert; if (cert) { if (Array.isArray(cert)) { for (i = 0; i < cert.length; ++i) { From ecf4c5e1713c6f81cb9b80674543b2af600f2794 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 17 Apr 2018 07:43:02 +0200 Subject: [PATCH 2/2] squash: use object destructuring for ca and cert --- lib/_tls_common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_tls_common.js b/lib/_tls_common.js index 16a892c4b6eda8..fb6ac34d1e68ad 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -96,7 +96,7 @@ exports.createSecureContext = function createSecureContext(options, context) { // NOTE: It's important to add CA before the cert to be able to load // cert's issuer in C++ code. - const ca = options.ca; + const { ca } = options; if (ca) { if (Array.isArray(ca)) { for (i = 0; i < ca.length; ++i) { @@ -112,7 +112,7 @@ exports.createSecureContext = function createSecureContext(options, context) { c.context.addRootCerts(); } - const cert = options.cert; + const { cert } = options; if (cert) { if (Array.isArray(cert)) { for (i = 0; i < cert.length; ++i) {