File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ if (!common.hasCrypto)
66 common . skip ( 'missing crypto' ) ;
77
88const tls = require ( 'tls' ) ;
9-
109const assert = require ( 'assert' ) ;
1110
1211const cert = fixtures . readSync ( 'test_cert.pem' ) ;
@@ -15,19 +14,20 @@ const key = fixtures.readSync('test_key.pem');
1514// https://github.com/nodejs/node/issues/1489
1615// tls.connect(options) with no options.host should accept a cert with
1716// CN:'localhost'
18- tls . createServer ( {
17+ const server = tls . createServer ( {
1918 key,
2019 cert
21- } ) . listen ( 0 , function ( ) {
20+ } ) . listen ( 0 , common . mustCall ( function ( ) {
2221 const socket = tls . connect ( {
2322 port : this . address ( ) . port ,
2423 ca : cert ,
2524 // No host set here. 'localhost' is the default,
2625 // but tls.checkServerIdentity() breaks before the fix with:
2726 // Error: Hostname/IP doesn't match certificate's altnames:
2827 // "Host: undefined. is not cert's CN: localhost"
29- } , function ( ) {
28+ } , common . mustCall ( function ( ) {
3029 assert ( socket . authorized ) ;
31- process . exit ( ) ;
32- } ) ;
33- } ) ;
30+ socket . destroy ( ) ;
31+ server . close ( ) ;
32+ } ) ) ;
33+ } ) ) ;
You can’t perform that action at this time.
0 commit comments