Merge pull request #370 from jmatthewsr-ms/master

Fix for slab buffer retention, leading to large memory consumption
This commit is contained in:
Charlie Robbins 2013-04-09 11:02:56 -07:00
commit 3763dc935f

View File

@ -439,12 +439,15 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
// Performs a WebSocket proxy operation to the location specified by // Performs a WebSocket proxy operation to the location specified by
// `this.target`. // `this.target`.
// //
HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) { HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead, buffer) {
var self = this, var self = this,
outgoing = new(this.target.base), outgoing = new(this.target.base),
listeners = {}, listeners = {},
errState = false, 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 // WebSocket requests must have the `GET` method and