| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 26f2eb8 commit 29b89ba
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ const tls = require('tls'); | |||
| 12 | 12 | ||
| 13 | 13 | const options = { | |
| 14 | 14 | key: fixtures.readKey('agent1-key.pem'), | |
| 15 | - cert: fixtures.readKey('agent1-cert.pem') | ||
| 15 | + cert: fixtures.readKey('agent1-cert.pem'), | ||
| 16 | 16 | }; | |
| 17 | 17 | ||
| 18 | 18 | const server = tls.Server(options, common.mustCall((socket) => { | |
@@ -45,28 +45,26 @@ server.listen(0, common.mustCall(() => { | |||
| 45 | 45 | rejectUnauthorized: false, | |
| 46 | 46 | port | |
| 47 | 47 | }; | |
| 48 | - const client = | ||
| 49 | - tls.connect(options, common.mustCall(() => { | ||
| 50 | - client.write(''); | ||
| 51 | - // Negotiation is still permitted for this first | ||
| 52 | - // attempt. This should succeed. | ||
| 53 | - client.renegotiate( | ||
| 54 | - { rejectUnauthorized: false }, | ||
| 55 | - common.mustCall(() => { | ||
| 56 | - // Once renegotiation completes, we write some | ||
| 57 | - // data to the socket, which triggers the on | ||
| 58 | - // data event on the server. After that data | ||
| 59 | - // is received, disableRenegotiation is called. | ||
| 60 | - client.write('data', common.mustCall(() => { | ||
| 61 | - client.write(''); | ||
| 62 | - // This second renegotiation attempt should fail | ||
| 63 | - // and the callback should never be invoked. The | ||
| 64 | - // server will simply drop the connection after | ||
| 65 | - // emitting the error. | ||
| 66 | - client.renegotiate( | ||
| 67 | - { rejectUnauthorized: false }, | ||
| 68 | - common.mustNotCall()); | ||
| 69 | - })); | ||
| 70 | - })); | ||
| 48 | + const client = tls.connect(options, common.mustCall(() => { | ||
| 49 | + client.write(''); | ||
| 50 | + // Negotiation is still permitted for this first | ||
| 51 | + // attempt. This should succeed. | ||
| 52 | + let ok = client.renegotiate(options, common.mustCall((err) => { | ||
| 53 | + assert.ifError(err); | ||
| 54 | + // Once renegotiation completes, we write some | ||
| 55 | + // data to the socket, which triggers the on | ||
| 56 | + // data event on the server. After that data | ||
| 57 | + // is received, disableRenegotiation is called. | ||
| 58 | + client.write('data', common.mustCall(() => { | ||
| 59 | + client.write(''); | ||
| 60 | + // This second renegotiation attempt should fail | ||
| 61 | + // and the callback should never be invoked. The | ||
| 62 | + // server will simply drop the connection after | ||
| 63 | + // emitting the error. | ||
| 64 | + ok = client.renegotiate(options, common.mustNotCall()); | ||
| 65 | + assert.strictEqual(ok, true); | ||
| 66 | + })); | ||
| 71 | 67 | })); | |
| 68 | + assert.strictEqual(ok, true); | ||
| 69 | + })); | ||
| 72 | 70 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments