Permalink
Browse files

Merge pull request #370 from jmatthewsr-ms/master

Fix for slab buffer retention, leading to large memory consumption
  • Loading branch information...
indexzero committed Apr 9, 2013
2 parents 71183bf + d2888c8 commit 3763dc935fb5f7aa41be4ad38ee26ce5ff622ef3
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/node-http-proxy/http-proxy.js
@@ -439,12 +439,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

0 comments on commit 3763dc9

Please sign in to comment.