mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
da3949cfd7
PR-URL: https://github.com/nodejs/node/pull/43949 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Feng Yu <F3n67u@outlook.com>
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
function request(server) {
|
|
http.get({
|
|
port: server.address().port,
|
|
path: '/',
|
|
}, (res) => {
|
|
res.resume();
|
|
});
|
|
}
|
|
|
|
{
|
|
const server = http.createServer((req, res) => {
|
|
// Hack to not remove parser out of server.connectionList
|
|
// See `freeParser` in _http_common.js
|
|
req.socket.parser.free = common.mustCall();
|
|
req.socket.on('close', common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
res.end('ok');
|
|
}).listen(0, common.mustCall(() => {
|
|
request(server);
|
|
}));
|
|
}
|
|
|
|
{
|
|
const server = http.createServer((req, res) => {
|
|
// See `freeParser` in _http_common.js
|
|
const { parser } = req.socket;
|
|
parser.free = common.mustCall(() => {
|
|
setImmediate(common.mustCall(() => {
|
|
parser.close();
|
|
}));
|
|
});
|
|
req.socket.on('close', common.mustCall(() => {
|
|
setImmediate(common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
}));
|
|
res.end('ok');
|
|
}).listen(0, common.mustCall(() => {
|
|
request(server);
|
|
}));
|
|
}
|