Permalink
Browse files

Fixed large DoS vector in the middleware implementation

  • Loading branch information...
1 parent 7beead5 commit 8cf6d7c111aee11fa49dde98d02780ebd68fee6c @tj committed Sep 1, 2011
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/node-http-proxy.js
View
@@ -125,11 +125,15 @@ exports.stack = function stack (middlewares, proxy) {
handle = function (req, res) {
var next = function (err) {
if (err) {
- throw err;
- //
- // TODO: figure out where to send errors.
- // return error(req, res, err);
- //
+ console.error(err.stack);
+ if (res._headerSent) {
+ res.destroy();
+ } else {
+ res.statusCode = 500;
+ res.setHeader('Content-Type', 'text/plain');
+ res.end('Internal Server Error');
+ }
+ return;
}
child(req, res);
}

0 comments on commit 8cf6d7c

Please sign in to comment.