Skip to content

Commit 8a3b183

Browse files
committed
quic: move pure-QUIC fields back from Http3Session to QuicSession
1 parent 7977f9a commit 8a3b183

3 files changed

Lines changed: 16 additions & 26 deletions

File tree

‎doc/api/quic.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,10 +4248,11 @@ session should be used instead of the raw QUIC session for all HTTP/3
42484248
interactions. The streams that this session exposes are still `QuicStream`
42494249
instances, but they gain HTTP/3 APIs and functionality from the application.
42504250

4251-
The HTTP/3 session API exposes all key HTTP/3 session details: the settings,
4252-
statistics, TLS identity, and HTTP/3-level events. The QUIC transport details
4253-
underneath (e.g. paths, transport parameters, and key updates) remain on the
4254-
QUIC session, accessible as [`http3session.quicSession`][].
4251+
The HTTP/3 session API exposes the HTTP/3 session details: the settings,
4252+
statistics, and HTTP/3-level events. The connection details underneath (e.g.
4253+
the TLS identity and negotiated ALPN, paths, transport parameters, and key
4254+
updates) remain on the QUIC session, accessible as
4255+
[`http3session.quicSession`][].
42554256

42564257
HTTP/3 frames every stream on the connection, so once this is attached,
42574258
streams cannot be opened on the QUIC session directly:
@@ -4305,9 +4306,8 @@ added: REPLACEME
43054306
-->
43064307

43074308
Each of the following behaves exactly as the member of the same name on the
4308-
underlying [`QuicSession`][]: `alpnProtocol`, `certificate`, `close()`,
4309-
`closed`, `destroy()`, `destroyed`, `ephemeralKeyInfo`, `opened`,
4310-
`peerCertificate`, `servername`, and `stats`.
4309+
underlying [`QuicSession`][]: `close()`, `closed`, `closing`, `destroy()`,
4310+
`destroyed`, `opened`, and `stats`.
43114311

43124312
Any callback set through the `Http3Session` - `onerror` and the
43134313
HTTP/3-specific ones below - is invoked with the `Http3Session` as `this`.

‎lib/internal/quic/http3.js‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,6 @@ class Http3Session {
206206
*/
207207
get settings() { return this.#session.applicationOptions; }
208208

209-
/** @type {string|undefined} */
210-
get servername() { return this.#session.servername; }
211-
212-
/** @type {string|undefined} */
213-
get alpnProtocol() { return this.#session.alpnProtocol; }
214-
215-
/** @type {object|undefined} */
216-
get certificate() { return this.#session.certificate; }
217-
218-
/** @type {object|undefined} */
219-
get peerCertificate() { return this.#session.peerCertificate; }
220-
221-
/** @type {object|undefined} */
222-
get ephemeralKeyInfo() { return this.#session.ephemeralKeyInfo; }
223-
224209
/** @type {quic.QuicSession.Stats} */
225210
get stats() { return this.#session.stats; }
226211

@@ -283,6 +268,9 @@ class Http3Session {
283268
/** @type {Promise<void>} */
284269
get closed() { return this.#session.closed; }
285270

271+
/** @type {boolean} */
272+
get closing() { return this.#session.closing; }
273+
286274
/** @type {boolean} */
287275
get destroyed() { return this.#session.destroyed; }
288276

‎test/parallel/test-quic-h3-attach.mjs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ assert.throws(() => new Http3Session(), { code: 'ERR_ILLEGAL_CONSTRUCTOR' });
6969
const client = Http3Session.from(quicClient);
7070
await client.opened;
7171

72-
assert.strictEqual(client.alpnProtocol, 'h3');
73-
assert.strictEqual(client.servername, 'localhost');
72+
// Connection details, TLS included, stay on the QUIC session:
73+
assert.strictEqual(client.quicSession.alpnProtocol, 'h3');
74+
assert.strictEqual(client.quicSession.servername, 'localhost');
75+
assert.strictEqual('peerCertificate' in client, false);
7476
assert.strictEqual(typeof client.stats.createdAt, 'bigint');
75-
assert.strictEqual(typeof client.ephemeralKeyInfo, 'object');
77+
assert.strictEqual(client.closing, client.quicSession.closing);
7678
await client.close();
7779
await endpoint.close();
7880
}
@@ -126,7 +128,7 @@ const tooLate = {
126128
// Further already-settled awaits are still the same checkpoint.
127129
await null;
128130
const http3 = Http3Session.from(client);
129-
assert.strictEqual(http3.alpnProtocol, 'h3');
131+
assert.strictEqual(http3.quicSession, client);
130132
await http3.close();
131133
await endpoint.close();
132134
}

0 commit comments

Comments
 (0)