[websockets] add latest websockets support

This commit is contained in:
Fedor Indutny 2011-09-30 04:34:33 +07:00 committed by indexzero
parent 6c6fec094e
commit 45ef87e71b

View File

@ -393,7 +393,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
//
// Setup the incoming client socket.
//
_socket(socket);
_socket(socket, true);
//
// On `upgrade` from the Agent socket, listen to
@ -663,7 +663,12 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
// request. This is small, and there's only ever one of
// it; no need for pause/resume.
//
// XXX This is very wrong and should be fixed in node's core
//
reverseProxy.write(head);
if (head && head.length === 0) {
reverseProxy._send('');
}
}
catch (ex) {
return proxyError(ex);