mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
39 lines
740 B
JavaScript
39 lines
740 B
JavaScript
// see https://github.com/joyent/node/issues/3257
|
|
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var http = require('http');
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
req.resume();
|
|
req.once('end', function() {
|
|
res.writeHead(200);
|
|
res.end();
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
server.listen(common.PIPE, function() {
|
|
var req = http.request({
|
|
socketPath: common.PIPE,
|
|
headers: {'Content-Length':'1'},
|
|
method: 'POST',
|
|
path: '/'
|
|
});
|
|
|
|
req.write('.');
|
|
|
|
sched(function() { req.end() }, 5);
|
|
});
|
|
|
|
// schedule a callback after `ticks` event loop ticks
|
|
function sched(cb, ticks) {
|
|
function fn() {
|
|
if (--ticks)
|
|
setImmediate(fn);
|
|
else
|
|
cb();
|
|
}
|
|
setImmediate(fn);
|
|
}
|