title: How to close a request in nodejs?
body: <h2>What I have:</h2>
  
  <p>I'm using <a href="http://nodejs.org/">node.js</a> with the <a href="https://github.com/visionmedia/express">express framework</a> and I'm building a form where I can upload files, I'm using <a href="https://github.com/felixge/node-formidable">node-formidable</a> for this.</p>
  
  <h2>What's the problem</h2>
  
  <p>My problem is that I can't close the request if I found an error with the uploaded files. I want to check file types, size etc.. So I can get the proper files uploaded, and the files are actually not uploaded so I don't waste time.</p>
  
  <p>So the problem is that I can't stop the HTTP request.</p>
  
  <h2>What I have tried</h2>
  
  <p>Here is what I have tried so far:</p>
  
  <pre><code>request.connection.destroy();
  response.end('something went wrong...');
  </code></pre>
  
  <p>I assume that the <code>connection.destroy()</code> aborts the request, and I know this because it fires the formidables form abort event (<code>form.on('abort', function(){ ... })</code>) But the file is still uploading, and the response doesn't arrives just after the file was uploaded.</p>
  
  <p><strong>So how should I close the HTTP Request, and send a message back to the client?</strong></p>
  
  <p>EDIT:
  And something else, when I don't use <code>response.end()</code> then it works, except that the Client waits for the the answer, it's weird :\</p>