mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
http: don't destroy completed request
Calling destroy() on a completed ClientRequest, i.e. once 'close' will be emitted should be a noop. Also before emitting 'close' destroyed === true. Fixes: https://github.com/nodejs/node/issues/32851 PR-URL: https://github.com/nodejs/node/pull/33120 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
parent
8a6fab02ad
commit
b04e88439a
10 changed files with 60 additions and 5 deletions
|
@ -23,7 +23,10 @@ server.listen(0, options.host, function() {
|
|||
req.on('error', function() {
|
||||
// This space is intentionally left blank
|
||||
});
|
||||
req.on('close', common.mustCall(() => server.close()));
|
||||
req.on('close', common.mustCall(() => {
|
||||
assert.strictEqual(req.destroyed, true);
|
||||
server.close();
|
||||
}));
|
||||
|
||||
let timeout_events = 0;
|
||||
req.on('timeout', common.mustCall(() => timeout_events += 1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue