From 45ef87e71bc9cccefe5fb6afc3121fb09b8efbc3 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Fri, 30 Sep 2011 04:34:33 +0700 Subject: [PATCH] [websockets] add latest websockets support --- lib/node-http-proxy/http-proxy.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index faf133f..204641b 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -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);