summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
authorLevente Kurusa <lkurusa@kernelstuff.org>2023-05-02 02:14:13 +0200
committerGitHub <noreply@github.com>2023-05-02 02:14:13 +0200
commit000315e75a20e82616a227702c98346f2b5e8b59 (patch)
tree281b33e21f63cf3a2d161a111d41a747d1e3e6fd /ext/node
parent2ee55145c06e5986c96f9eb40653464e81d79413 (diff)
fix(node/http): Request.setTimeout(0) should clear (#18949)
Fixes: #18932
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/polyfills/http.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index 1a585f74c..6f7877742 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -351,6 +351,18 @@ class ClientRequest extends NodeWritable {
}
setTimeout(timeout: number, callback?: () => void) {
+ if (timeout == 0) {
+ // Node's underlying Socket implementation expects a 0 value to disable the
+ // existing timeout.
+ if (this.opts.timeout) {
+ clearTimeout(this.opts.timeout);
+ this.opts.timeout = undefined;
+ this.opts.signal = undefined;
+ }
+
+ return;
+ }
+
const controller = new AbortController();
this.opts.signal = controller.signal;