You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'd do:

    req.on("data", function(d) {
      if (pdata.length>1024) return;
      pdata+=d;
      ...
    

    If you're in control of everything, hopefully nothing will ever overflow - but if you're trying to protect against someone deliberately sending more data then they could very easily fake the Content-Length header.

About

Avatar for Gordon @Gordon started