mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
PR-URL: https://github.com/nodejs/node/pull/60729 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
27 lines
691 B
JavaScript
27 lines
691 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const { createServer, get } = require('http');
|
|
|
|
const server = createServer(common.mustCall(function(req, res) {
|
|
req.resume();
|
|
|
|
setTimeout(common.mustCall(() => {
|
|
res.writeHead(204, { 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=1' });
|
|
res.end();
|
|
}), common.platformTimeout(1000));
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const port = server.address().port;
|
|
|
|
get(`http://localhost:${port}`, common.mustCall((res) => {
|
|
server.close();
|
|
})).on('finish', common.mustCall(() => {
|
|
setTimeout(common.mustCall(() => {
|
|
server.closeIdleConnections();
|
|
}), common.platformTimeout(500));
|
|
}));
|
|
}));
|