Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed `limit()`: respond with 413 when content-length exceeds the l…

…imit

we could do this with chunked as well
although you would be stuck waiting for a
potentially _massive_ body
  • Loading branch information...
commit cbb17fe39043bc9c9ab67ce19de334907e1aa386 1 parent df45c12
@tj tj authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/middleware/limit.js
View
6 lib/middleware/limit.js
@@ -43,7 +43,11 @@ module.exports = function limit(bytes){
req._limit = true;
// limit by content-length
- if (len && len > bytes) deny();
+ if (len && len > bytes) {
+ res.statusCode = 413;
+ res.end('Request Entity Too Large');
+ return;
+ }
// limit
req.on('data', function(chunk){
Please sign in to comment.
Something went wrong with that request. Please try again.