If I write the following program in node:
http.createServer(function (req, res) {
if( req.method == 'GET' ) {
var body = ''; req.on('data', function(data) { body += data });
req.on('end', function() {
console.log('request ended')
});
}
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('142
');
}).listen(3500);
And then hit the server with http://xxx.xx.xxx.xx:35010
I see a request ended
twice on my console -- I'm not sure why a single HTTP request is causing this to execute twice.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…