Skip to content

Commit 07c8d2e

Browse files
tjindexzero
authored andcommitted
Fixed large DoS vector in the middleware implementation
1 parent 5575bcf commit 07c8d2e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/node-http-proxy.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ exports.stack = function stack (middlewares, proxy) {
125125
handle = function (req, res) {
126126
var next = function (err) {
127127
if (err) {
128-
throw err;
129-
//
130-
// TODO: figure out where to send errors.
131-
// return error(req, res, err);
132-
//
128+
console.error(err.stack);
129+
if (res._headerSent) {
130+
res.destroy();
131+
} else {
132+
res.statusCode = 500;
133+
res.setHeader('Content-Type', 'text/plain');
134+
res.end('Internal Server Error');
135+
}
136+
return;
133137
}
134138
child(req, res);
135139
}

0 commit comments

Comments
 (0)