问题
I came across this thread Node.js HTTPS Secure Error which mentions that the tls module is the way to do TLS on node now. It seems that setSecure() has been dropped. I'm trying to do a STARTTLS for XMPP. This means that the socket will be upgraded midway. How do I go about doing this on node.js > 0.4.0?
回答1:
Try this: https://gist.github.com/848444
回答2:
Take a close look at the lib/tls.js file in the Node Github repo.
https://github.com/joyent/node/blob/master/lib/tls.js#L949-992
Another resource that you really might like is here:
https://github.com/andris9/rai/blob/master/lib/starttls.js
来源:https://stackoverflow.com/questions/5146666/starttls-on-node-js-0-4-0