summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/http.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-08-29 14:13:58 +0200
committerGitHub <noreply@github.com>2023-08-29 12:13:58 +0000
commit2929313652a9d7fb3a26ad7f754deaeb03435e10 (patch)
treecd6e08ae77e255f956b448b50463cf549d63a30a /ext/node/polyfills/http.ts
parentc31c93ce70c1147872d911c4a05c808d4078339b (diff)
fix(node/http): don't leak resources on destroyed request (#20040)
Closes https://github.com/denoland/deno/issues/19828
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r--ext/node/polyfills/http.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index 1103e93c3..ae670d5f0 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -787,6 +787,13 @@ class ClientRequest extends OutgoingMessage {
}
this.destroyed = true;
+ const rid = this._client?.rid;
+ if (rid) {
+ core.tryClose(rid);
+ }
+ if (this._req.cancelHandleRid !== null) {
+ core.tryClose(this._req.cancelHandleRid);
+ }
// If we're aborting, we don't care about any more response data.
if (this.res) {
this.res._dump();