-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: do not rely on the 'agentRemove' event
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: #20786 Fixes: #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>
- Loading branch information
1 parent
dd32a7a
commit 75e4415
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'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(); | ||
})); | ||
})); |