This allows for web servers to be "hijacked" and used as Web Socket servers (or other). You simply listen for requests as normal, but check if req.upgrade === true If so, this will be the last request of the connection. It's your job now to hijack req.connection and start reading from it. req.upgradeHead is a buffer containing the first part of the new protocol communication (in the case it arrived on the same packet). This needs tests and documentation. API subject to change.
When making a TCP connection, readyState returns 'opening' while resolving the host. However between the resolving period and the establishing a connection period, it would return 'closed'. This fixes it. This change also ensures that the socket is closed before the 'end' event is emitted in the case that the socket was previously shutdown.
and furthermore error out of one of them isn't a DNS option. Test case by Ben Lund <email@example.com>; additional help from Tim Caswell <firstname.lastname@example.org>.