mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 06:19:07 +00:00

Do not use the `'agentRemove'` event to null `socket._httpMessage` as that event is public and can be used to not keep a request in the agent. PR-URL: https://github.com/nodejs/node/pull/20786 Fixes: https://github.com/nodejs/node/issues/20690 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
22 lines
488 B
JavaScript
22 lines
488 B
JavaScript
'use strict';
|
|
const { mustCall } = require('../common');
|
|
|
|
const http = require('http');
|
|
const { strictEqual } = require('assert');
|
|
|
|
const server = http.createServer(mustCall((req, res) => {
|
|
res.flushHeaders();
|
|
}));
|
|
|
|
server.listen(0, mustCall(() => {
|
|
const req = http.get({
|
|
port: server.address().port
|
|
}, mustCall(() => {
|
|
const { socket } = req;
|
|
socket.emit('agentRemove');
|
|
strictEqual(socket._httpMessage, req);
|
|
socket.destroy();
|
|
server.close();
|
|
}));
|
|
}));
|