tls_wrap: use localhost if options.host is empty
authorGuilherme Souza <sitegui@sitegui.com.br>
Tue, 21 Apr 2015 21:24:13 +0000 (18:24 -0300)
committerRoman Reiss <me@silverwind.io>
Thu, 23 Apr 2015 14:54:11 +0000 (16:54 +0200)
commita7d74633f20e285395f5e2860bdac56381603476
tree43b8f4d69197ba239bf7f1dce7ea7ee114596cda
parent22aafa55971ef762863ec8badcd76228581d40c6
tls_wrap: use localhost if options.host is empty

tls.connect(options) with no options.host should accept a certificate
with CN: 'localhost'. Fix Error: Hostname/IP doesn't match
certificate's altnames: "Host: undefined. is not cert's CN: localhost"

'localhost' is not added directly to defaults because that is not
always desired (for example, when using options.socket)

PR-URL: https://github.com/iojs/io.js/pull/1493
Fixes: https://github.com/iojs/io.js/issues/1489
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
lib/_tls_wrap.js
test/parallel/test-tls-connect-no-host.js [new file with mode: 0644]