Skip to content

Commit 5908e84

Browse files
authored
Remove net.isIP() check for TLS servername (#312)
Fixes #308.
1 parent 28104d2 commit 5908e84

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.changeset/seven-camels-check.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"https-proxy-agent": patch
3+
"pac-proxy-agent": patch
4+
"socks-proxy-agent": patch
5+
---
6+
7+
Remove `net.isIP()` check for TLS `servername`

packages/https-proxy-agent/src/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ export class HttpsProxyAgent<Uri extends string> extends Agent {
9696
this.connectOpts.servername || this.connectOpts.host;
9797
socket = tls.connect({
9898
...this.connectOpts,
99-
servername:
100-
servername && net.isIP(servername) ? undefined : servername,
99+
servername,
101100
});
102101
} else {
103102
debug('Creating `net.Socket`: %o', this.connectOpts);
@@ -151,7 +150,7 @@ export class HttpsProxyAgent<Uri extends string> extends Agent {
151150
return tls.connect({
152151
...omit(opts, 'host', 'path', 'port'),
153152
socket,
154-
servername: net.isIP(servername) ? undefined : servername,
153+
servername,
155154
});
156155
}
157156

packages/pac-proxy-agent/src/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ export class PacProxyAgent<Uri extends string> extends Agent {
240240
const servername = opts.servername || opts.host;
241241
socket = tls.connect({
242242
...opts,
243-
servername:
244-
!servername || net.isIP(servername)
245-
? undefined
246-
: servername,
243+
servername,
247244
});
248245
} else {
249246
socket = net.connect(opts);

packages/socks-proxy-agent/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class SocksProxyAgent extends Agent {
175175
const tlsSocket = tls.connect({
176176
...omit(opts, 'host', 'path', 'port'),
177177
socket,
178-
servername: net.isIP(servername) ? undefined : servername,
178+
servername,
179179
});
180180

181181
tlsSocket.once('error', (error) => {

0 commit comments

Comments
 (0)