-
Notifications
You must be signed in to change notification settings - Fork 30k
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. Backport-PR-URL: #20786 PR-URL: #20786 Fixes: #20690 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
- Loading branch information
1 parent
873ee2e
commit 52cc2d2
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(); | ||
})); | ||
})); |
52cc2d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backport-PR-URL
is incorrect, it should have been #21734