| 372 | /^"(?:[^"\\\u0000-\u001f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"/; |
| 373 | |
| 374 | function splitEscapedAltNames(altNames) { |
| 375 | const result = []; |
| 376 | let currentToken = ''; |
| 377 | let offset = 0; |
| 378 | while (offset !== altNames.length) { |
| 379 | const nextSep = altNames.indexOf(',', offset); |
| 380 | const nextQuote = altNames.indexOf('"', offset); |
| 381 | if (nextQuote !== -1 && (nextSep === -1 || nextQuote < nextSep)) { |
| 382 | // There is a quote character and there is no separator before the quote. |
| 383 | currentToken += altNames.substring(offset, nextQuote); |
| 384 | const match = jsonStringPattern.exec(altNames.substring(nextQuote)); |
| 385 | if (!match) { |
| 386 | throw new ERR_TLS_CERT_ALTNAME_FORMAT(); |
| 387 | } |
| 388 | currentToken += JSONParse(match[0]); |
| 389 | offset = nextQuote + match[0].length; |
| 390 | } else if (nextSep !== -1) { |
| 391 | // There is a separator and no quote before it. |
| 392 | currentToken += altNames.substring(offset, nextSep); |
| 393 | result.push(currentToken); |
| 394 | currentToken = ''; |
| 395 | offset = nextSep + 2; |
| 396 | } else { |
| 397 | currentToken += altNames.substring(offset); |
| 398 | offset = altNames.length; |
| 399 | } |
| 400 | } |
| 401 | result.push(currentToken); |
| 402 | return result; |
| 403 | } |
| 404 | |
| 405 | exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { |
| 406 | const subject = cert.subject; |