title: HttpListener - Limit Request Length
body: <p>I'm writing a HttpListener based server which accepts binary files and uploads to S3. I want to reject big files before actually reading whole request. This is my approach:</p>
  
  <pre><code>var ctx = await listener.GetContextAsync();
  var req = ctx.Request;
  
  if ( req.ContentLength64 &gt; SIZE_LIMIT )
      result = ERROR_RESPONSE;
  else
  {
      using ( BinaryReader r = new BinaryReader( req.InputStream ) )
      {
          bytes = r.ReadBytes( Convert.ToInt32( req.ContentLength64 ) );
          upload( bytes );
      }
  }
  </code></pre>
  
  <p>So, my question is, if I check HttpListenerRequest.ContentLength64 before reading anything from the InputStream, HttpListener doesn't read the binary content, does it?</p>