MCPcopy Index your code
hub / github.com/nodejs/node / splitEscapedAltNames

Function splitEscapedAltNames

lib/tls.js:374–403  ·  view source on GitHub ↗
(altNames)

Source from the content-addressed store, hash-verified

372 /^"(?:[^"\\\u0000-\u001f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"/;
373
374function 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
405exports.checkServerIdentity = function checkServerIdentity(hostname, cert) {
406 const subject = cert.subject;

Callers 1

tls.jsFile · 0.85

Calls 3

indexOfMethod · 0.45
execMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…