From d2888c83f5eab3fb82425ef4fd51e62621bf2764 Mon Sep 17 00:00:00 2001 From: Justin Matthews Date: Thu, 24 Jan 2013 15:44:06 -0800 Subject: [PATCH] Fix for retaining large slab buffers in node core --- lib/node-http-proxy/http-proxy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index e23d551ca..fe9a9dfe7 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -390,12 +390,15 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // Performs a WebSocket proxy operation to the location specified by // `this.target`. // -HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) { +HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead, buffer) { var self = this, outgoing = new(this.target.base), listeners = {}, errState = false, - CRLF = '\r\n'; + CRLF = '\r\n', + //copy upgradeHead to avoid retention of large slab buffers used in node core + head = new Buffer(upgradeHead.length); + upgradeHead.copy(head); // // WebSocket requests must have the `GET` method and