Skip to content

Commit d2888c8

Browse files
author
Justin Matthews
committed
Fix for retaining large slab buffers in node core
1 parent 26d3646 commit d2888c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/node-http-proxy/http-proxy.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,15 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
390390
// Performs a WebSocket proxy operation to the location specified by
391391
// `this.target`.
392392
//
393-
HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) {
393+
HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead, buffer) {
394394
var self = this,
395395
outgoing = new(this.target.base),
396396
listeners = {},
397397
errState = false,
398-
CRLF = '\r\n';
398+
CRLF = '\r\n',
399+
//copy upgradeHead to avoid retention of large slab buffers used in node core
400+
head = new Buffer(upgradeHead.length);
401+
upgradeHead.copy(head);
399402

400403
//
401404
// WebSocket requests must have the `GET` method and

0 commit comments

Comments
 (0)