mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
http: always emit close on req and res
PR-URL: https://github.com/nodejs/node/pull/20611 Fixes: https://github.com/nodejs/node/issues/20600 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
2db83fdc0c
commit
8029a2473e
2 files changed
+18
No files matched your search
@@ -561,6 +561,8 @@ function resOnFinish(req, res, socket, state, server) {
|
||||
req._dump();
|
||||
|
||||
res.detachSocket(socket);
|
||||
req.emit('close');
|
||||
res.emit('close');
|
||||
|
||||
if (res._last) {
|
||||
if (typeof socket.destroySoon === 'function') {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const http = require('http');
|
||||
|
||||
const server = http.Server(common.mustCall((req, res) => {
|
||||
res.end();
|
||||
res.on('finish', common.mustCall());
|
||||
res.on('close', common.mustCall());
|
||||
req.on('close', common.mustCall());
|
||||
res.socket.on('close', () => server.close());
|
||||
}));
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
http.get({ port: server.address().port }, common.mustCall());
|
||||
}));
|
||||
Reference in new issue
Block a user