Browse Source

tls: fix 'hostless' tls connection verification

And fix last failing tests
v0.8.7-release
Fedor Indutny 13 years ago
parent
commit
50122fed8a
  1. 2
      lib/tls.js
  2. 7
      test/simple/test-tls-client-verify.js

2
lib/tls.js

@ -1208,7 +1208,7 @@ exports.connect = function(/* [port, host], options, cb */) {
var sslcontext = crypto.createCredentials(options);
convertNPNProtocols(options.NPNProtocols, this);
var hostname = options.servername || options.host,
var hostname = options.servername || options.host || 'localhost',
pair = new SecurePair(sslcontext, false, true,
options.rejectUnauthorized === true ? true : false,
{

7
test/simple/test-tls-client-verify.js

@ -25,6 +25,7 @@ if (!process.versions.openssl) {
}
var hosterr = 'Hostname/IP doesn\'t match certificate\'s altnames';
var testCases =
[{ ca: ['ca1-cert'],
key: 'agent2-key',
@ -101,10 +102,12 @@ function testServers(index, servers, clientOptions, cb) {
console.error('connecting...');
var client = tls.connect(clientOptions, function() {
var authorized = client.authorized ||
client.authorizationError === hosterr;
console.error('expected: ' + ok + ' authed: ' + client.authorized);
console.error('expected: ' + ok + ' authed: ' + authorized);
assert.equal(ok, client.authorized);
assert.equal(ok, authorized);
server.close();
});

Loading…
Cancel
Save