| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c6be79a commit ff9b5fc
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,15 +100,12 @@ exports.createSecureContext = function createSecureContext(options) { | |||
| 100 | 100 | ||
| 101 | 101 | const c = new SecureContext(options.secureProtocol, secureOptions, | |
| 102 | 102 | options.minVersion, options.maxVersion); | |
| 103 | - let i; | ||
| 104 | - let val; | ||
| 105 | 103 | ||
| 106 | 104 | // Add CA before the cert to be able to load cert's issuer in C++ code. | |
| 107 | 105 | const { ca } = options; | |
| 108 | 106 | if (ca) { | |
| 109 | 107 | if (ArrayIsArray(ca)) { | |
| 110 | - for (i = 0; i < ca.length; ++i) { | ||
| 111 | - val = ca[i]; | ||
| 108 | + for (const val of ca) { | ||
| 112 | 109 | validateKeyOrCertOption('ca', val); | |
| 113 | 110 | c.context.addCACert(val); | |
| 114 | 111 | } | |
@@ -123,8 +120,7 @@ exports.createSecureContext = function createSecureContext(options) { | |||
| 123 | 120 | const { cert } = options; | |
| 124 | 121 | if (cert) { | |
| 125 | 122 | if (ArrayIsArray(cert)) { | |
| 126 | - for (i = 0; i < cert.length; ++i) { | ||
| 127 | - val = cert[i]; | ||
| 123 | + for (const val of cert) { | ||
| 128 | 124 | validateKeyOrCertOption('cert', val); | |
| 129 | 125 | c.context.setCert(val); | |
| 130 | 126 | } | |
@@ -142,8 +138,7 @@ exports.createSecureContext = function createSecureContext(options) { | |||
| 142 | 138 | const passphrase = options.passphrase; | |
| 143 | 139 | if (key) { | |
| 144 | 140 | if (ArrayIsArray(key)) { | |
| 145 | - for (i = 0; i < key.length; ++i) { | ||
| 146 | - val = key[i]; | ||
| 141 | + for (const val of key) { | ||
| 147 | 142 | // eslint-disable-next-line eqeqeq | |
| 148 | 143 | const pem = (val != undefined && val.pem !== undefined ? val.pem : val); | |
| 149 | 144 | validateKeyOrCertOption('key', pem); | |
@@ -242,8 +237,8 @@ exports.createSecureContext = function createSecureContext(options) { | |||
| 242 | 237 | ||
| 243 | 238 | if (options.crl) { | |
| 244 | 239 | if (ArrayIsArray(options.crl)) { | |
| 245 | - for (i = 0; i < options.crl.length; i++) { | ||
| 246 | - c.context.addCRL(options.crl[i]); | ||
| 240 | + for (const crl of options.crl) { | ||
| 241 | + c.context.addCRL(crl); | ||
| 247 | 242 | } | |
| 248 | 243 | } else { | |
| 249 | 244 | c.context.addCRL(options.crl); | |
@@ -259,8 +254,7 @@ exports.createSecureContext = function createSecureContext(options) { | |||
| 259 | 254 | toBuf = require('internal/crypto/util').toBuf; | |
| 260 | 255 | ||
| 261 | 256 | if (ArrayIsArray(options.pfx)) { | |
| 262 | - for (i = 0; i < options.pfx.length; i++) { | ||
| 263 | - const pfx = options.pfx[i]; | ||
| 257 | + for (const pfx of options.pfx) { | ||
| 264 | 258 | const raw = pfx.buf ? pfx.buf : pfx; | |
| 265 | 259 | const buf = toBuf(raw); | |
| 266 | 260 | const passphrase = pfx.passphrase || options.passphrase; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -530,9 +530,9 @@ function makeMethodProxy(name) { | |||
| 530 | 530 | return this._parent[name].apply(this._parent, args); | |
| 531 | 531 | }; | |
| 532 | 532 | } | |
| 533 | - for (let n = 0; n < proxiedMethods.length; n++) { | ||
| 534 | - tls_wrap.TLSWrap.prototype[proxiedMethods[n]] = | ||
| 535 | - makeMethodProxy(proxiedMethods[n]); | ||
| 533 | + for (const proxiedMethod of proxiedMethods) { | ||
| 534 | + tls_wrap.TLSWrap.prototype[proxiedMethod] = | ||
| 535 | + makeMethodProxy(proxiedMethod); | ||
| 536 | 536 | } | |
| 537 | 537 | ||
| 538 | 538 | tls_wrap.TLSWrap.prototype.close = function close(cb) { | |
@@ -1412,8 +1412,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( | |||
| 1412 | 1412 | function SNICallback(servername, callback) { | |
| 1413 | 1413 | const contexts = this.server._contexts; | |
| 1414 | 1414 | ||
| 1415 | - for (let i = 0; i < contexts.length; i++) { | ||
| 1416 | - const elem = contexts[i]; | ||
| 1415 | + for (const elem of contexts) { | ||
| 1417 | 1416 | if (elem[0].test(servername)) { | |
| 1418 | 1417 | callback(null, elem[1]); | |
| 1419 | 1418 | return; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,11 @@ const { | |||
| 9 | 9 | // C=US\nST=CA\nL=SF\nO=Joyent\nOU=Node.js\nCN=ca1\nemailAddress=ry@clouds.org | |
| 10 | 10 | function parseCertString(s) { | |
| 11 | 11 | const out = ObjectCreate(null); | |
| 12 | - const parts = s.split('\n'); | ||
| 13 | - for (let i = 0, len = parts.length; i < len; i++) { | ||
| 14 | - const sepIndex = parts[i].indexOf('='); | ||
| 12 | + for (const part of s.split('\n')) { | ||
| 13 | + const sepIndex = part.indexOf('='); | ||
| 15 | 14 | if (sepIndex > 0) { | |
| 16 | - const key = parts[i].slice(0, sepIndex); | ||
| 17 | - const value = parts[i].slice(sepIndex + 1); | ||
| 15 | + const key = part.slice(0, sepIndex); | ||
| 16 | + const value = part.slice(sepIndex + 1); | ||
| 18 | 17 | if (key in out) { | |
| 19 | 18 | if (!ArrayIsArray(out[key])) { | |
| 20 | 19 | out[key] = [out[key]]; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments