When does the http.IncomingMessage fire its 'close' event?
According to the documentation it should occur when the underlaying connection was closed. However, it is never called for the following example code (I made sure it is not caused by keep-alive):
var http = require('http'),
fs = require('fs');
var server = http.createServer(function(req, res) {
res.shouldKeepAlive = false;
req.on("end", function() {
console.log("request end");
});
req.on("close", function() {
console.log("request close"); // Never called
});
res.end("Close connection");
});
server.listen(5555);
I'm using node.js v0.10.22.