diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 1a585f74ce..6f78777428 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;