Skip to content

Commit 780ab4d

Browse files
committed
fix: skip SNI for IP addresses in TLS connection
1 parent e38aeea commit 780ab4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/base/connection.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ class BaseConnection extends EventEmitter {
345345
});
346346
const rejectUnauthorized = this.config.ssl.rejectUnauthorized;
347347
const verifyIdentity = this.config.ssl.verifyIdentity;
348-
const servername = this.config.host;
348+
// only set servername for SNI and identity check if host is not an IP address
349+
const servername = Net.isIP(this.config.host)
350+
? undefined
351+
: this.config.host;
349352

350353
let secureEstablished = false;
351354
this.stream.removeAllListeners('data');

0 commit comments

Comments
 (0)