From 34d7eb481b910906b381837ed91c21510b89f547 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Fri, 5 Apr 2024 23:01:23 -0700 Subject: [PATCH 1/2] Remove `net.isIP()` check for TLS `servername` Fixes #308. --- packages/https-proxy-agent/src/index.ts | 5 ++--- packages/pac-proxy-agent/src/index.ts | 5 +---- packages/socks-proxy-agent/src/index.ts | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/https-proxy-agent/src/index.ts b/packages/https-proxy-agent/src/index.ts index 47da1dc3..272f7790 100644 --- a/packages/https-proxy-agent/src/index.ts +++ b/packages/https-proxy-agent/src/index.ts @@ -96,8 +96,7 @@ export class HttpsProxyAgent extends Agent { this.connectOpts.servername || this.connectOpts.host; socket = tls.connect({ ...this.connectOpts, - servername: - servername && net.isIP(servername) ? undefined : servername, + servername, }); } else { debug('Creating `net.Socket`: %o', this.connectOpts); @@ -151,7 +150,7 @@ export class HttpsProxyAgent extends Agent { return tls.connect({ ...omit(opts, 'host', 'path', 'port'), socket, - servername: net.isIP(servername) ? undefined : servername, + servername, }); } diff --git a/packages/pac-proxy-agent/src/index.ts b/packages/pac-proxy-agent/src/index.ts index 9b402dd3..57aa06d5 100644 --- a/packages/pac-proxy-agent/src/index.ts +++ b/packages/pac-proxy-agent/src/index.ts @@ -240,10 +240,7 @@ export class PacProxyAgent extends Agent { const servername = opts.servername || opts.host; socket = tls.connect({ ...opts, - servername: - !servername || net.isIP(servername) - ? undefined - : servername, + servername, }); } else { socket = net.connect(opts); diff --git a/packages/socks-proxy-agent/src/index.ts b/packages/socks-proxy-agent/src/index.ts index c6b84db7..7a911d20 100644 --- a/packages/socks-proxy-agent/src/index.ts +++ b/packages/socks-proxy-agent/src/index.ts @@ -175,7 +175,7 @@ export class SocksProxyAgent extends Agent { const tlsSocket = tls.connect({ ...omit(opts, 'host', 'path', 'port'), socket, - servername: net.isIP(servername) ? undefined : servername, + servername, }); tlsSocket.once('error', (error) => { From a1a353c1beec0d2b45f481ab1ac4f87deeb0a166 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Fri, 5 Apr 2024 23:02:48 -0700 Subject: [PATCH 2/2] Create seven-camels-check.md --- .changeset/seven-camels-check.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/seven-camels-check.md diff --git a/.changeset/seven-camels-check.md b/.changeset/seven-camels-check.md new file mode 100644 index 00000000..1040691e --- /dev/null +++ b/.changeset/seven-camels-check.md @@ -0,0 +1,7 @@ +--- +"https-proxy-agent": patch +"pac-proxy-agent": patch +"socks-proxy-agent": patch +--- + +Remove `net.isIP()` check for TLS `servername`