| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 41c5524 commit eedc131
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1512,11 +1512,13 @@ function onConnectSecure() { | |||
| 1512 | 1512 | debug('client emit secureConnect. rejectUnauthorized: %s, ' + | |
| 1513 | 1513 | 'authorizationError: %s', options.rejectUnauthorized, | |
| 1514 | 1514 | this.authorizationError); | |
| 1515 | + this.secureConnecting = false; | ||
| 1515 | 1516 | this.emit('secureConnect'); | |
| 1516 | 1517 | } | |
| 1517 | 1518 | } else { | |
| 1518 | 1519 | this.authorized = true; | |
| 1519 | 1520 | debug('client emit secureConnect. authorized:', this.authorized); | |
| 1521 | + this.secureConnecting = false; | ||
| 1520 | 1522 | this.emit('secureConnect'); | |
| 1521 | 1523 | } | |
| 1522 | 1524 | ||
| 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