mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f5b8853d40
PR-URL: https://github.com/nodejs/node/pull/24191 Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
23 lines
489 B
JavaScript
23 lines
489 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const net = require('net');
|
|
const server = http.createServer(function(req, res) {
|
|
res.end();
|
|
});
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
const req = http.request({
|
|
port: this.address().port
|
|
}, common.mustCall());
|
|
|
|
req.on('abort', common.mustCall(function() {
|
|
server.close();
|
|
}));
|
|
|
|
req.end();
|
|
req.abort();
|
|
|
|
req.emit('response', new http.IncomingMessage(new net.Socket()));
|
|
}));
|