nodejitsu/node-http-proxy — pull request #495 by glasser (2013-10-08 23:26:26+00:00)
Title: Emit http-proxy:outgoing:ws:error for errors after the upgrade header.

The Node http client (at least in 0.10.x) removes the socket error handler
(which forwards errors from socket to request) before invoking 'upgrade'. So we
need to put our error handler back on it if we don't want errors (eg
ECONNRESET/EPIPE) talking to the server to throw.

See https://gist.github.com/glasser/6893545 for an example script showing why this is necessary.