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) {
668
668
*/
669
669
function tlsConnect ( options ) {
670
670
options . path = undefined ;
671
- options . servername = options . servername || options . host ;
671
+
672
+ if ( ! options . servername && options . servername !== '' ) {
673
+ options . servername = options . host ;
674
+ }
675
+
672
676
return tls . connect ( options ) ;
673
677
}
674
678
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const assert = require('assert');
6
6
const crypto = require ( 'crypto' ) ;
7
7
const https = require ( 'https' ) ;
8
8
const http = require ( 'http' ) ;
9
+ const tls = require ( 'tls' ) ;
9
10
const fs = require ( 'fs' ) ;
10
11
const { URL } = require ( 'url' ) ;
11
12
@@ -2040,6 +2041,18 @@ describe('WebSocket', () => {
2040
2041
} ) ;
2041
2042
} ) ;
2042
2043
} ) . 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
+ } ) ;
2043
2056
} ) ;
2044
2057
2045
2058
describe ( 'Request headers' , ( ) => {
You can’t perform that action at this time.
0 commit comments