| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f236b3a commit b64ce59
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | 3 | const net = require('net'); | |
| 4 | 4 | const url = require('url'); | |
| 5 | - const util = require('util'); | ||
| 6 | 5 | const binding = process.binding('crypto'); | |
| 7 | 6 | const Buffer = require('buffer').Buffer; | |
| 8 | 7 | const constants = require('constants'); | |
@@ -141,9 +140,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { | |||
| 141 | 140 | return ip === host; | |
| 142 | 141 | }); | |
| 143 | 142 | if (!valid) { | |
| 144 | - reason = util.format('IP: %s is not in the cert\'s list: %s', | ||
| 145 | - host, | ||
| 146 | - ips.join(', ')); | ||
| 143 | + reason = `IP: ${host} is not in the cert's list: ${ips.join(', ')}`; | ||
| 147 | 144 | } | |
| 148 | 145 | } else if (cert.subject) { | |
| 149 | 146 | // Transform hostname to canonical form | |
@@ -189,13 +186,11 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { | |||
| 189 | 186 | ||
| 190 | 187 | if (!valid) { | |
| 191 | 188 | if (cert.subjectaltname) { | |
| 192 | - reason = util.format('Host: %s is not in the cert\'s altnames: %s', | ||
| 193 | - host, | ||
| 194 | - cert.subjectaltname); | ||
| 189 | + reason = | ||
| 190 | + `Host: ${host} is not in the cert's altnames: ` + | ||
| 191 | + `${cert.subjectaltname}`; | ||
| 195 | 192 | } else { | |
| 196 | - reason = util.format('Host: %s is not cert\'s CN: %s', | ||
| 197 | - host, | ||
| 198 | - cert.subject.CN); | ||
| 193 | + reason = `Host: ${host} is not cert's CN: ${cert.subject.CN}`; | ||
| 199 | 194 | } | |
| 200 | 195 | } | |
| 201 | 196 | } else { | |
@@ -204,8 +199,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { | |||
| 204 | 199 | ||
| 205 | 200 | if (!valid) { | |
| 206 | 201 | var err = new Error( | |
| 207 | - util.format('Hostname/IP doesn\'t match certificate\'s altnames: %j', | ||
| 208 | - reason)); | ||
| 202 | + `Hostname/IP doesn't match certificate's altnames: "${reason}"`); | ||
| 209 | 203 | err.reason = reason; | |
| 210 | 204 | err.host = host; | |
| 211 | 205 | err.cert = cert; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments