diff --git a/lib/tls.js b/lib/tls.js index 0d85a948dc..8bd9991d87 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -2,7 +2,6 @@ const net = require('net'); const url = require('url'); -const util = require('util'); const binding = process.binding('crypto'); const Buffer = require('buffer').Buffer; const constants = require('constants'); @@ -126,9 +125,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { return ip === host; }); if (!valid) { - reason = util.format('IP: %s is not in the cert\'s list: %s', - host, - ips.join(', ')); + reason = `IP: ${host} is not in the cert's list: ${ips.join(', ')}`; } } else if (cert.subject) { // Transform hostname to canonical form @@ -174,13 +171,11 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { if (!valid) { if (cert.subjectaltname) { - reason = util.format('Host: %s is not in the cert\'s altnames: %s', - host, - cert.subjectaltname); + reason = + `Host: ${host} is not in the cert's altnames: ` + + `${cert.subjectaltname}`; } else { - reason = util.format('Host: %s is not cert\'s CN: %s', - host, - cert.subject.CN); + reason = `Host: ${host} is not cert's CN: ${cert.subject.CN}`; } } } else { @@ -189,8 +184,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { if (!valid) { var err = new Error( - util.format('Hostname/IP doesn\'t match certificate\'s altnames: %j', - reason)); + `Hostname/IP doesn't match certificate's altnames: "${reason}"`); err.reason = reason; err.host = host; err.cert = cert;