From e8473e620a637cfb2032c1c2010086a48be76721 Mon Sep 17 00:00:00 2001 From: viiprogrammer Date: Sun, 5 Jan 2025 03:34:54 +0300 Subject: [PATCH] fix(proxy-agent): add fallback value for servername when using requestTls fixes #3988 --- lib/dispatcher/proxy-agent.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/dispatcher/proxy-agent.js b/lib/dispatcher/proxy-agent.js index c5b4d51babb..a6dda163913 100644 --- a/lib/dispatcher/proxy-agent.js +++ b/lib/dispatcher/proxy-agent.js @@ -87,12 +87,7 @@ class ProxyAgent extends DispatcherBase { callback(null, socket) return } - let servername - if (this[kRequestTls]) { - servername = this[kRequestTls].servername - } else { - servername = opts.servername - } + const servername = this[kRequestTls]?.servername || opts.servername this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback) } catch (err) { if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {