Skip to content

Commit 769e9fe

Browse files
committed
Allow upgrade stream request to be GCd once body has finished
1 parent cbdcf8b commit 769e9fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/_http_server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,8 @@ class UpgradeStream extends Duplex {
10191019
}
10201020

10211021
requestBodyCompleted(upgradeHead) {
1022+
this[kIncomingMessage] = null;
1023+
10221024
// When the request body is completed, we begin streaming all the
10231025
// post-body data for the upgraded protocol:
10241026
if (upgradeHead?.length > 0) {
@@ -1039,7 +1041,7 @@ class UpgradeStream extends Duplex {
10391041
// important that this happens, even if there are no listeners, or it
10401042
// would be impossible to read this without explicitly reading all the
10411043
// request body first, which is backward incompatible & awkward.
1042-
this[kIncomingMessage].resume();
1044+
this[kIncomingMessage]?.resume();
10431045

10441046
this[kSocket].resume();
10451047
}

0 commit comments

Comments
 (0)