joyent/node — pull request #3653 by RushPL (2012-07-06 13:34:46+00:00)
Title: Allow tls.connect to start on server-side sockets and add tls.start as a simple wrapper for tls.connect

I have a found a piece of code floating on the internet to initiate a TLS function in the middle of a TCP connection, but the code in question has not functioned well.

There was a previous pull request for this function https://github.com/joyent/node/pull/848
However, current state of connect does not allow to start TLS arbitralily on a server-side socket.

Thus, I propose a very simple change to `tls.connect` allowing to say whether we want a server side socket via `options.asServer` but also I add a very nice intuitive wrapper called tls.start and two tests.

`tls.start` is in the same style as `child_process.fork` so I think it fits together inside node.

I am willing to update documention if a green light is given to this improvements.