From 17540d3dac31a0b8d6f401aef6ed28d8d5ef2d4a Mon Sep 17 00:00:00 2001 From: Kai Tamkun Date: Wed, 26 Feb 2025 14:54:28 -0800 Subject: [PATCH] Don't override Host header --- src/js/node/http.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/js/node/http.ts b/src/js/node/http.ts index 86a4cbf16b..2ea7f7500e 100644 --- a/src/js/node/http.ts +++ b/src/js/node/http.ts @@ -2927,26 +2927,26 @@ function ClientRequest(input, options, cb) { } } - if (host && !this.getHeader("host") && setHost) { - let hostHeader = host; + // if (host && !this.getHeader("host") && setHost) { + // let hostHeader = host; - // For the Host header, ensure that IPv6 addresses are enclosed - // in square brackets, as defined by URI formatting - // https://tools.ietf.org/html/rfc3986#section-3.2.2 - const posColon = StringPrototypeIndexOf.$call(hostHeader, ":"); - if ( - posColon !== -1 && - StringPrototypeIncludes.$call(hostHeader, ":", posColon + 1) && - StringPrototypeCharCodeAt.$call(hostHeader, 0) !== 91 /* '[' */ - ) { - hostHeader = `[${hostHeader}]`; - } + // // For the Host header, ensure that IPv6 addresses are enclosed + // // in square brackets, as defined by URI formatting + // // https://tools.ietf.org/html/rfc3986#section-3.2.2 + // const posColon = StringPrototypeIndexOf.$call(hostHeader, ":"); + // if ( + // posColon !== -1 && + // StringPrototypeIncludes.$call(hostHeader, ":", posColon + 1) && + // StringPrototypeCharCodeAt.$call(hostHeader, 0) !== 91 /* '[' */ + // ) { + // hostHeader = `[${hostHeader}]`; + // } - if (port && +port !== defaultPort) { - hostHeader += ":" + port; - } - this.setHeader("Host", hostHeader); - } + // if (port && +port !== defaultPort) { + // hostHeader += ":" + port; + // } + // this.setHeader("Host", hostHeader); + // } var auth = options.auth; if (auth && !this.getHeader("Authorization")) {