File tree 3 files changed +24
-4
lines changed
3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ exports.connect = function connect(options, cb) {
24
24
if ( 'key' in options || 'cert' in options || 'ca' in options || 'pfx' in
25
25
options || options . useTLS === true ) {
26
26
createSocket = exports . createSecureSocket ;
27
+ if ( ! ( 'servername' in options ) ) {
28
+ options . servername = options . host ;
29
+ }
27
30
} else {
28
31
createSocket = exports . createSocket ;
29
32
}
30
33
var socket = createSocket ( options , cb ) ;
31
34
socket . setNoDelay ( true ) ;
32
35
return socket ;
33
- } ;
36
+ } ;
Original file line number Diff line number Diff line change 6
6
],
7
7
"name" : " hdb" ,
8
8
"description" : " SAP HANA Database Client for Node" ,
9
- "version" : " 0.17.2 " ,
9
+ "version" : " 0.18.0 " ,
10
10
"repository" : {
11
11
"type" : " git" ,
12
12
"url" : " git://github.com/SAP/node-hdb.git"
Original file line number Diff line number Diff line change @@ -30,11 +30,28 @@ describe('Lib', function () {
30
30
tcp . createSecureSocket = function tlsConnect ( options , cb ) {
31
31
tcp . createSecureSocket = createSecureSocket ;
32
32
options . allowHalfOpen . should . equal ( false ) ;
33
+ options . servername . should . equal ( options . host ) ;
33
34
process . nextTick ( cb ) ;
34
35
return socket ;
35
36
} ;
36
37
tcp . connect ( {
37
- pfx : true
38
+ pfx : true ,
39
+ host : 'localhost'
40
+ } , done ) . should . equal ( socket ) ;
41
+ } ) ;
42
+
43
+ it ( 'should override default servername' , function ( done ) {
44
+ tcp . createSecureSocket = function tlsConnect ( options , cb ) {
45
+ tcp . createSecureSocket = createSecureSocket ;
46
+ options . allowHalfOpen . should . equal ( false ) ;
47
+ options . servername . should . equal ( 'customSNI' ) ;
48
+ process . nextTick ( cb ) ;
49
+ return socket ;
50
+ } ;
51
+ tcp . connect ( {
52
+ pfx : true ,
53
+ host : 'localhost' ,
54
+ servername : 'customSNI'
38
55
} , done ) . should . equal ( socket ) ;
39
56
} ) ;
40
57
@@ -49,4 +66,4 @@ describe('Lib', function () {
49
66
} ) ;
50
67
51
68
} ) ;
52
- } ) ;
69
+ } ) ;
You can’t perform that action at this time.
0 commit comments