tls: accept empty `net.Socket`s
authorFedor Indutny <fedor@indutny.com>
Tue, 3 Mar 2015 20:17:43 +0000 (15:17 -0500)
committerFedor Indutny <fedor@indutny.com>
Tue, 3 Mar 2015 22:05:55 +0000 (17:05 -0500)
commit7b3b8acfa6a9de825b95c6c5a12eb965c6e0c01d
tree0e23404345a81c9ce7f4f4847668cbb985ea4103
parente1bf6709dc720fa06359ccd745d81cafc37dbd39
tls: accept empty `net.Socket`s

Accept `new net.Socket()` as a `socket` option to `tls.connect()`
without triggering an assertion error in C++.

This is done by wrapping it into a JSStream to ensure that there will be
a handle at the time of wrapping the socket into TLSSocket.

Fix: https://github.com/iojs/io.js/issues/987
PR-URL: https://github.com/iojs/io.js/pull/1046
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
lib/_tls_wrap.js
test/parallel/test-tls-on-empty-socket.js [new file with mode: 0644]