diff --git a/lib/_tls_common.js b/lib/_tls_common.js index d75b9ffe28..6e98c1ee4d 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -43,6 +43,7 @@ exports.createSecureContext = function createSecureContext(options, context) { secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE; var c = new SecureContext(options.secureProtocol, secureOptions, context); + var i; if (context) return c; @@ -50,7 +51,7 @@ exports.createSecureContext = function createSecureContext(options, context) { // cert's issuer in C++ code. if (options.ca) { if (Array.isArray(options.ca)) { - for (let i = 0, len = options.ca.length; i < len; i++) { + for (i = 0; i < options.ca.length; i++) { c.context.addCACert(options.ca[i]); } } else { @@ -62,7 +63,7 @@ exports.createSecureContext = function createSecureContext(options, context) { if (options.cert) { if (Array.isArray(options.cert)) { - for (let i = 0; i < options.cert.length; i++) + for (i = 0; i < options.cert.length; i++) c.context.setCert(options.cert[i]); } else { c.context.setCert(options.cert); @@ -75,9 +76,8 @@ exports.createSecureContext = function createSecureContext(options, context) { // which leads to the crash later on. if (options.key) { if (Array.isArray(options.key)) { - for (let i = 0; i < options.key.length; i++) { - var key = options.key[i]; - + for (i = 0; i < options.key.length; i++) { + const key = options.key[i]; if (key.passphrase) c.context.setKey(key.pem, key.passphrase); else @@ -103,14 +103,14 @@ exports.createSecureContext = function createSecureContext(options, context) { c.context.setECDHCurve(options.ecdhCurve); if (options.dhparam) { - var warning = c.context.setDHParam(options.dhparam); + const warning = c.context.setDHParam(options.dhparam); if (warning) internalUtil.trace(warning); } if (options.crl) { if (Array.isArray(options.crl)) { - for (let i = 0, len = options.crl.length; i < len; i++) { + for (i = 0; i < options.crl.length; i++) { c.context.addCRL(options.crl[i]); } } else {