-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(new TLSSocket(new net.Socket())).connect() fails silently. #3963
Comments
Thanks for submitting this. I had some time to think since our last conversation, and it looks like this is not the way it should be used. Sorry for not figuring it out in first place! Could you please try using just |
I guess this issue may be treated as a documentation bug, because it is not completely clear how |
Is the usage for upgrading a I'm looking at the code, and it does specifically take a net.Socket and wraps it and uses the wrapped handle. Trying
Trying As per @mscdex, I also tested That said, |
@Havvy No, I meant something like this: var Socket = require('net').Socket;
var tls = require('tls');
var sock = new Socket();
var secureSock = tls.connect({ socket: s }, function() {
console.log("The tls socket connected. Yay!");
});
sock.connect({port: 6697, host: "irc.freenode.net"}); That's typically how you upgrade an existing socket, but if you're using TLS from the start, then just use var tls = require('tls');
var secureSock = tls.connect({port: 6697, host: "irc.freenode.net"}, function() {
console.log("The tls socket connected. Yay!");
secureSock.write(...);
}); |
Ah, okay. So if you pass in a That's the missing piece of information. So, based on that... The TLSSocket constructor documentation should be updated to point that out. Should calling TLSSocket.connect() throw an error if there's a wrapped net socket? |
@Havvy, mind submitting a PR for that doc? |
Hi all: Was this resolved in minervapanda's commit? If not, I'm happy to tackle it. |
@VerteDinde no it wasn't. That commit never made it to the official repo. |
@TimothyGu Cool, I'll make a PR now. :) |
…02 in doc/api/tls.md
@TimothyGu PR submitted! Please let me know if I need to make any changes and thanks for all of the work that you do. ✨ |
Is this still open? |
@nikshepsvn Judging from #14062 I think this should be closed now. |
I think this can be closed, following discussion in #14062 (starting at #14062 (review)). FWIW #14062 (comment) contains a long list of documentation things that are probably EDIT: Didn't see @joyeecheung 's comment |
(EDIT by @Trott: Turns out this is a documentation bug. Labeling
good-first-contribution
anddoc
.)The program ends immediately after the connect is called, telling me that the connection isn't started.
Note that if we don't wrap the
net.Socket
in aTLSSocket
, then the connect works as expected.The text was updated successfully, but these errors were encountered: