| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 70768ce commit 12d76b8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1523,10 +1523,12 @@ function onConnectSecure() { | |||
| 1523 | 1523 | debug('client emit secureConnect. rejectUnauthorized: %s, ' + | |
| 1524 | 1524 | 'authorizationError: %s', options.rejectUnauthorized, | |
| 1525 | 1525 | this.authorizationError); | |
| 1526 | + this.secureConnecting = false; | ||
| 1526 | 1527 | this.emit('secureConnect'); | |
| 1527 | 1528 | } else { | |
| 1528 | 1529 | this.authorized = true; | |
| 1529 | 1530 | debug('client emit secureConnect. authorized:', this.authorized); | |
| 1531 | + this.secureConnecting = false; | ||
| 1530 | 1532 | this.emit('secureConnect'); | |
| 1531 | 1533 | } | |
| 1532 | 1534 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,9 +9,11 @@ const { | |||
| 9 | 9 | } = require('../common'); | |
| 10 | 10 | if (!hasCrypto) | |
| 11 | 11 | skip('missing crypto'); | |
| 12 | + const fixtures = require('../common/fixtures'); | ||
| 12 | 13 | const assert = require('assert'); | |
| 13 | - const { createServer, connect } = require('http2'); | ||
| 14 | + const { createServer, createSecureServer, connect } = require('http2'); | ||
| 14 | 15 | const { connect: netConnect } = require('net'); | |
| 16 | + const { connect: tlsConnect } = require('tls'); | ||
| 15 | 17 | ||
| 16 | 18 | // Check for session connect callback and event | |
| 17 | 19 | { | |
@@ -70,6 +72,36 @@ const { connect: netConnect } = require('net'); | |||
| 70 | 72 | connect(authority).on('error', () => {}); | |
| 71 | 73 | } | |
| 72 | 74 | ||
| 75 | + // Check for session connect callback on already connected TLS socket | ||
| 76 | + { | ||
| 77 | + const serverOptions = { | ||
| 78 | + key: fixtures.readKey('agent1-key.pem'), | ||
| 79 | + cert: fixtures.readKey('agent1-cert.pem') | ||
| 80 | + }; | ||
| 81 | + const server = createSecureServer(serverOptions); | ||
| 82 | + server.listen(0, mustCall(() => { | ||
| 83 | + const { port } = server.address(); | ||
| 84 | + | ||
| 85 | + const onSocketConnect = () => { | ||
| 86 | + const authority = `https://localhost:${port}`; | ||
| 87 | + const createConnection = mustCall(() => socket); | ||
| 88 | + const options = { createConnection }; | ||
| 89 | + connect(authority, options, mustCall(onSessionConnect)); | ||
| 90 | + }; | ||
| 91 | + | ||
| 92 | + const onSessionConnect = (session) => { | ||
| 93 | + session.close(); | ||
| 94 | + server.close(); | ||
| 95 | + }; | ||
| 96 | + | ||
| 97 | + const clientOptions = { | ||
| 98 | + port, | ||
| 99 | + rejectUnauthorized: false | ||
| 100 | + }; | ||
| 101 | + const socket = tlsConnect(clientOptions, mustCall(onSocketConnect)); | ||
| 102 | + })); | ||
| 103 | + } | ||
| 104 | + | ||
| 73 | 105 | // Check for error for init settings error | |
| 74 | 106 | { | |
| 75 | 107 | createServer(function() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments