From 2f749dde18d4da93d81dbcd78e82aa417d03c179 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Wed, 10 Jun 2026 15:33:00 +0200 Subject: [PATCH] quic: impl. cb for http/3 settings/app. options Implements a callback that is invoked once http/3 settings are received. Background, http/3 settings usually arrive a bit later than connection establishment, and e.g. for webtransport these settings are used to indicate support. So e.g. the examples for quiche from google, wait for the settings to arrive. (This is different to http/2). The implemented callback mechanism allows to wait for the settings to arrive until connection attempts are made. As settings are stored in the generic applications option object, the callback's name refers to the application rather than the settings. Whether this is a good choice is debatable. Fixes: https://github.com/nodejs/node/issues/63553 Signed-off-by: Marten Richter PR-URL: https://github.com/nodejs/node/pull/63558 Backport-PR-URL: https://github.com/nodejs/node/pull/64675 Reviewed-By: James M Snell Reviewed-By: Tim Perry Reviewed-By: Stephen Belanger Reviewed-By: Matteo Collina --- doc/api/quic.md | 47 ++++++++++++++-- lib/internal/quic/diagnostics.js | 2 + lib/internal/quic/quic.js | 71 +++++++++++++++++++++++++ lib/internal/quic/state.js | 9 ++++ lib/internal/quic/symbols.js | 2 + src/quic/bindingdata.h | 1 + src/quic/http3.cc | 2 + src/quic/session.cc | 28 ++++++++++ src/quic/session.h | 1 + test/parallel/test-quic-h3-settings.mjs | 9 ++++ 10 files changed, 167 insertions(+), 5 deletions(-) diff --git a/doc/api/quic.md b/doc/api/quic.md index 35a31f28026..0442522d0e3 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -914,6 +914,8 @@ added: REPLACEME The current application-level options for this session. These include settings that are specific to the negotiated application protocol (e.g. HTTP/3) and may be negotiated separately from the transport parameters. Read only. +You can use the callback [`session.onapplication`][] to be informed, when settings +from the remote arrive. ### `session.close([options])` @@ -1046,6 +1048,16 @@ added: v23.8.0 The endpoint that created this session. Returns `null` if the session has been destroyed. Read only. +### `session.onapplication` + + + +* Type: {quic.OnApplicationCallback} + +The callback to invoke when new application options, e.g. HTTP/3 settings arrived. + ### `session.onerror` + +* `this` {quic.QuicSession} +* `applicationoption` {quic.QuicSession} + +The callback function that is invoked when application options change. +E.g. for http/3 settings are included in applications options and +may arrive after the connection is established. + ### Callback: `OnPathValidationCallback` + +* `applicationoptions` {quic.ApplicationOptions} Current application options. +* `session` {quic.QuicSession} + +Published when a locally-initiated stream is opened. + ### Channel: `quic.session.created.client`