I'm not entirely sure when support for this API was introduced, but this works fine in my code on v0.8.25:
// create regular TCP connection var socket = net.connect({ host: 'google.com', port: 443 }); // upgrade to TLS socket = tls.connect({ socket: socket, servername: 'google.com' }); I've been using this logic in my custom http.Agent proxy implementations and it works great: https://github.com/TooTallNate/node-https-proxy-agent/blob/d86abc8aa2403df9dd0313b9f7959e2279605f09/https-proxy-agent.js#L88-L91 On Fri, Aug 16, 2013 at 12:54 PM, Kris Reeves <myn...@gmail.com> wrote: > Oh, cool; I'll give it a whirl. I do believe the code I borrowed should > work on 0.4-0.10 as well though, so I think it must be a problem elsewhere > in my code or in the way I'm using it. I just can't figure out what exactly > is happening on 0.10 that isn't happening on 0.8... > > > On Friday, August 16, 2013 6:39:42 AM UTC-7, Matt Sergeant wrote: > >> You could try the code that Haraka uses - I had to get it working on >> 0.4-0.10 so I can promise it works across the board. >> >> https://github.com/baudehlo/**Haraka/blob/master/tls_socket.**js<https://github.com/baudehlo/Haraka/blob/master/tls_socket.js> >> >> >> On Fri, Aug 16, 2013 at 12:59 AM, Kris Reeves <myn...@gmail.com> wrote: >> >>> I found this: >>> http://stackoverflow.com/**questions/11399986/how-can-i-** >>> upgrade-a-socket-to-tls-in-**node<http://stackoverflow.com/questions/11399986/how-can-i-upgrade-a-socket-to-tls-in-node> >>> >>> which gave me this: >>> https://github.com/andris9/**rai/blob/master/lib/starttls.**js<https://github.com/andris9/rai/blob/master/lib/starttls.js> >>> >>> which perfectly solved my problem, except I ran into this: >>> https://github.com/joyent/**node/issues/5140<https://github.com/joyent/node/issues/5140> >>> >>> which I eventually discovered had to do with this: >>> https://github.com/joyent/**node/issues/5190<https://github.com/joyent/node/issues/5190> >>> >>> My solution is now working, but only in node v0.10 -- and I need it in >>> v0.8 (or else I have to hunt down and verify all my other socket code) >>> >>> In v0.8, curl -v stops after the "SSLv2, Client hello(1)" line. In >>> v0.10, it continues past that to list the client's supported ciphers and >>> all that, and gets on with its business. >>> >>> I don't know how I can debug this, since it seems to be internal to >>> node, or perhaps openssl. Is anyone familiar with the specifics of these >>> bits and can maybe help me out? >>> >>> -- >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-* >>> *Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines> >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to nod...@googlegroups.com >>> >>> To unsubscribe from this group, send email to >>> nodejs+un...@**googlegroups.com >>> >>> For more options, visit this group at >>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en> >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to nodejs+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >> >> -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.