For security, I'd like to set a maximum request length in my node.js application. (There are many security vulnerabilities which take advantage of web servers allowing unlimited request lengths).
Is this possible? Is there one already?
For security, I'd like to set a maximum request length in my node.js application. (There are many security vulnerabilities which take advantage of web servers allowing unlimited request lengths).
Is this possible? Is there one already?
I'm guessing you are referring to the data a client can send you through POST. If you are using Express, you can use the limit middleware to achieve this: http://senchalabs.github.com/connect/middleware-limit.html
A short version of what's done there is:
req.on('data', function(chunk){
received += chunk.length;
if (received > bytes) req.destroy();
});