title: Node.js simple http request doesn't work
body: <p>I wonder why such <a href="http://nodejs.org/api/http.html#http_http_request_options_callback" rel="nofollow noreferrer">simple http request</a> is not working...</p>
  
  <pre class="lang-coffee prettyprint-override"><code>http = require("http")
  
  url = "http://nodejs.org/"
  
  console.log "Try a request to #{url}..."
  reqHttp = http.request url, (response) -&gt;
  
      console.log "Request to #{url}"
      response.on 'data', (chunk) -&gt; console.log "chunk: ", chunk 
  
  reqHttp.on 'error', (error) -&gt; console.log "reqHttp error", error
  </code></pre>
  
  <p>After a minute or so it returns:</p>
  
  <pre class="lang-coffee prettyprint-override"><code>reqHttp error { [Error: socket hang up] code: 'ECONNRESET' }
  </code></pre>
  
  <p>To make sure it is not a problem on my environment, I tried the <code>request</code> module and worked just fine:</p>
  
  <pre class="lang-coffee prettyprint-override"><code>request = require("request")
  
  url = "http://nodejs.org/"
  
  request url, (error, response, body) -&gt;
    console.log body if not error and response.statusCode is 200
  </code></pre>
  
  <p>It seems <a href="https://stackoverflow.com/questions/10771875/node-js-https-request-error">I'm not the only one</a>. </p>
  
  <p>So, I have a workaround for my problem (using <code>request</code> module), but I'd like to know why I can't use the buind-in http request. Is it buggy or unreliable? (Node.js version 0.8.21)</p>