Skip to content

Commit 19afe9a

Browse files
committed
fix: omit SNI for IP-based hostnames
Refs: tediousjs#1237
1 parent 529402b commit 19afe9a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/message-io.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import DuplexPair from 'native-duplexpair';
22

33
import { Duplex } from 'stream';
44
import * as tls from 'tls';
5-
import { Socket } from 'net';
5+
import { isIP, Socket } from 'net';
66
import { EventEmitter } from 'events';
77

88
import Debug from './debug';
@@ -73,7 +73,7 @@ class MessageIO extends EventEmitter {
7373
const securePair = this.securePair = {
7474
cleartext: tls.connect({
7575
socket: duplexpair.socket1 as Socket,
76-
servername: hostname,
76+
servername: isIP(hostname) ? '' : hostname,
7777
secureContext: secureContext,
7878
rejectUnauthorized: !trustServerCertificate
7979
}),

0 commit comments

Comments
 (0)