File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -668,7 +668,11 @@ function netConnect(options) {
668668 */
669669function tlsConnect ( options ) {
670670 options . path = undefined ;
671- options . servername = options . servername || options . host ;
671+
672+ if ( ! options . servername && options . servername !== '' ) {
673+ options . servername = options . host ;
674+ }
675+
672676 return tls . connect ( options ) ;
673677}
674678
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const assert = require('assert');
66const crypto = require ( 'crypto' ) ;
77const https = require ( 'https' ) ;
88const http = require ( 'http' ) ;
9+ const tls = require ( 'tls' ) ;
910const fs = require ( 'fs' ) ;
1011const { URL } = require ( 'url' ) ;
1112
@@ -2040,6 +2041,18 @@ describe('WebSocket', () => {
20402041 } ) ;
20412042 } ) ;
20422043 } ) . timeout ( 4000 ) ;
2044+
2045+ it ( 'allows to disable sending the SNI extension' , ( done ) => {
2046+ const original = tls . connect ;
2047+
2048+ tls . connect = ( options ) => {
2049+ assert . strictEqual ( options . servername , '' ) ;
2050+ tls . connect = original ;
2051+ done ( ) ;
2052+ } ;
2053+
2054+ const ws = new WebSocket ( 'wss://127.0.0.1' , { servername : '' } ) ;
2055+ } ) ;
20432056 } ) ;
20442057
20452058 describe ( 'Request headers' , ( ) => {
You can’t perform that action at this time.
0 commit comments