0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

tls: localhost is valid against identity-check

This commit is contained in:
Fedor Indutny 2012-07-20 20:47:05 +04:00
parent 8ba189b8d3
commit 0cf235410d
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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) {