| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cf10a94 commit 849f5c3
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,6 @@ if (!common.hasCrypto) | |||
| 6 | 6 | common.skip('missing crypto'); | |
| 7 | 7 | ||
| 8 | 8 | const tls = require('tls'); | |
| 9 | - | ||
| 10 | 9 | const assert = require('assert'); | |
| 11 | 10 | ||
| 12 | 11 | const cert = fixtures.readSync('test_cert.pem'); | |
@@ -15,19 +14,20 @@ const key = fixtures.readSync('test_key.pem'); | |||
| 15 | 14 | // https://github.com/nodejs/node/issues/1489 | |
| 16 | 15 | // tls.connect(options) with no options.host should accept a cert with | |
| 17 | 16 | // CN:'localhost' | |
| 18 | - tls.createServer({ | ||
| 17 | + const server = tls.createServer({ | ||
| 19 | 18 | key, | |
| 20 | 19 | cert | |
| 21 | - }).listen(0, function() { | ||
| 20 | + }).listen(0, common.mustCall(function() { | ||
| 22 | 21 | const socket = tls.connect({ | |
| 23 | 22 | port: this.address().port, | |
| 24 | 23 | ca: cert, | |
| 25 | 24 | // No host set here. 'localhost' is the default, | |
| 26 | 25 | // but tls.checkServerIdentity() breaks before the fix with: | |
| 27 | 26 | // Error: Hostname/IP doesn't match certificate's altnames: | |
| 28 | 27 | // "Host: undefined. is not cert's CN: localhost" | |
| 29 | - }, function() { | ||
| 28 | + }, common.mustCall(function() { | ||
| 30 | 29 | assert(socket.authorized); | |
| 31 | - process.exit(); | ||
| 32 | - }); | ||
| 33 | - }); | ||
| 30 | + socket.destroy(); | ||
| 31 | + server.close(); | ||
| 32 | + })); | ||
| 33 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments