}).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
+ res.resume();
res.on('end', function(err) {
if (err) throw err;
process.send('DONE');
res.on('data', function(chunk) {
console.log('Read ' + chunk.length + ' bytes');
- console.log(chunk.toString());
+ console.log(' chunk=%j', chunk.toString());
});
res.on('end', function() {
console.log('Response ended.');
});
+ res.on('aborted', function() {
+ console.log('Response aborted.');
+ });
+
+ res.socket.on('close', function() {
+ console.log('socket closed, but not res');
+ })
+
// it would be nice if this worked:
res.on('close', function() {
console.log('Response aborted');
var http = require('http');
var server = http.createServer(function(req, res) {
+ req.resume();
req.once('end', function() {
res.writeHead(200);
res.end();
function sched(cb, ticks) {
function fn() {
if (--ticks)
- process.nextTick(fn);
+ setImmediate(fn);
else
cb();
}
- process.nextTick(fn);
+ setImmediate(fn);
}