diff --git a/lib/tls.js b/lib/tls.js index be24283f460..4e427fefa88 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -85,10 +85,6 @@ function checkServerIdentity(host, cert) { // Add trailing dot (make hostnames uniform) if (!/\.$/.test(host)) host += '.'; - // Host names with less than one dots are considered too broad, - // and should not be allowed - if (!/^.+\..+$/.test(host)) return /$./; - // The same applies to hostname with more than one wildcard, // if hostname has wildcard when wildcards are not allowed, // or if there are less than two dots after wildcard (i.e. *.com or *d.com) diff --git a/test/simple/test-tls-check-server-identity.js b/test/simple/test-tls-check-server-identity.js index f79823b84cd..99835f8f5e3 100644 --- a/test/simple/test-tls-check-server-identity.js +++ b/test/simple/test-tls-check-server-identity.js @@ -180,6 +180,13 @@ var tests = [ }, result: false }, + { + host: 'localhost', cert: { + subjectaltname: 'DNS:a.com', + subject: { CN: 'localhost' } + }, + result: true + }, ]; tests.forEach(function(test, i) {