Skip to content

Commit

Permalink
tls_socket: tolerate spaces in CN string
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed May 3, 2024
1 parent 54fe157 commit 570e283
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ exports.parse_x509 = async (string) => {

res.expire = new Date(raw.match(/notAfter=(.* [A-Z]{3})/)[1])

const match = /CN=([^/\s,]+)/.exec(raw);
const match = /CN\s*=\s*([^\s,]+)/.exec(raw);
if (match && match[1]) res.names = [ match[1] ]

for (let name of Array.from(raw.matchAll(/DNS:([^\s,]+)/gm), (m) => m[0])) {
Expand Down

0 comments on commit 570e283

Please sign in to comment.