title: Why does node.js http doesn't call the end event when there is no data listener?
body: <p>I am sending data from a file to a server as a HTTP POST request like that:</p>
  
  <pre><code>var options = {
      "hostname": "example.com",
      "port": 42,
      "path": "/whatever",
      "method": "PUT",
      "headers" : {
          // a few headers
      }
  };
  
  var req = http.request(options, function(res) {
      res.on("end", function () {
          console.log("The request is finished");
      });
  });
  
  var stream = fs.createReadStream("/tmp/someFile");
  
  stream.on("data", function(data) {
      req.write(data);
  });
  
  stream.on("end", function() {
      req.end();
  });
  </code></pre>
  
  <p>I am listening for <code>res.on("end")</code> in order to do more stuff after the file is uploaded.</p>
  
  <p>However, in the example above, the <code>res.on("end")</code> is never called.</p>
  
  <p>What is striking, is that when I add a listener for the <code>data</code> event, <code>res.on("end")</code> is called reliably.</p>
  
  <p>This even works if I completely ignore the data as in the example below:</p>
  
  <pre><code>var options = {
      "hostname": "example.com",
      "port": 42,
      "path": "/whatever",
      "method": "PUT",
      "headers" : {
          // a few headers
      }
  };
  
  var req = http.request(options, function(res) {
      res.on("data", function () {
          /*
           * I don't even care for the data returned...
           */
      });
  
      res.on("end", function () {
          console.log("The request is finished");
      });
  });
  
  var stream = fs.createReadStream("/tmp/someFile");
  
  stream.on("data", function(data) {
      req.write(data);
  });
  
  stream.on("end", function() {
      req.end();
  });
  </code></pre>
  
  <p>Is this a bug? Is it the expected behaviour? Am I doing something wrong creating the request or reading the data from file?</p>