title: How to check actual content length against Content-Length header?
body: <p>A user can POST a document to our web service. We stream it elsewhere. But, at the end of the streaming, we need to be sure they didn't lie about their Content-Length.</p>
  
  <p>I assume if <code>headerContentLength &gt; realContentLength</code>, the request will just wait for them to send the rest, eventually timing out. So that's probably OK.</p>
  
  <p>What about if <code>headerContentLength &lt; realContentLength</code>? I.e. what if they keep sending data after they said they were done?</p>
  
  <p>Is this taken care of by Node.js in any way? If not, what is a good way to check? I suppose I could just count up the bytes inside of some <code>data</code> event listeners---i.e., <code>req.on("data", function (chunk) { totalBytes += chunk.length; })</code>. That seems like a kludge though.</p>