Skip to content

Commit

Permalink
tls: type checking for key, cert and ca options
Browse files Browse the repository at this point in the history
- Change iteration method from map -> forEach

Fixes: nodejs#12802
  • Loading branch information
jimmycann committed Aug 16, 2017
1 parent b132c96 commit c46fdd4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// cert's issuer in C++ code.
if (options.ca) {
if (Array.isArray(options.ca)) {
options.ca.map((ca) => {
options.ca.forEach((ca) => {
validateKeyCert(ca, 'ca');
c.context.addCACert(ca);
});
Expand All @@ -94,7 +94,7 @@ exports.createSecureContext = function createSecureContext(options, context) {

if (options.cert) {
if (Array.isArray(options.cert)) {
options.cert.map((cert) => {
options.cert.forEach((cert) => {
validateKeyCert(cert, 'cert');
c.context.setCert(cert);
});
Expand All @@ -110,7 +110,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// which leads to the crash later on.
if (options.key) {
if (Array.isArray(options.key)) {
options.key.map((k) => {
options.key.forEach((k) => {
validateKeyCert(k.pem || k, 'key');
c.context.setKey(k.pem || k, k.passphrase || options.passphrase);
});
Expand Down

0 comments on commit c46fdd4

Please sign in to comment.