From dab17f965fd7a0129ad5c24e4e6d40cd2ad504d7 Mon Sep 17 00:00:00 2001 From: Michael Chourdakis Date: Sun, 30 Nov 2025 11:13:20 +0200 Subject: [PATCH] Added chrome required settings for WebTransport --- .gitignore | 3 +++ lib/includes/nghttp3/nghttp3.h | 7 +++++++ lib/nghttp3_conn.c | 11 +++++++++++ lib/nghttp3_frame.h | 3 +++ lib/nghttp3_stream.c | 16 ++++++++++++++++ 5 files changed, 40 insertions(+) diff --git a/.gitignore b/.gitignore index 0b217713..a550965b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ # emacs backup file *~ +out64/ +out32/ +inst.bat # autotools *.la diff --git a/lib/includes/nghttp3/nghttp3.h b/lib/includes/nghttp3/nghttp3.h index bba55881..a28b0ec2 100644 --- a/lib/includes/nghttp3/nghttp3.h +++ b/lib/includes/nghttp3/nghttp3.h @@ -1826,6 +1826,13 @@ typedef struct nghttp3_settings { * v1.13.0. */ nghttp3_qpack_indexing_strat qpack_indexing_strat; + + // Setting 0x2b603742ULL 1.14.0 + uint64_t enable_web_transport; + + // Setting 0xffd277ULL 1.14.0 + uint64_t enable_webtransport_datagrams; + } nghttp3_settings; /** diff --git a/lib/nghttp3_conn.c b/lib/nghttp3_conn.c index b124162b..0afcceab 100644 --- a/lib/nghttp3_conn.c +++ b/lib/nghttp3_conn.c @@ -1944,6 +1944,17 @@ int nghttp3_conn_on_settings_entry_received(nghttp3_conn *conn, nghttp3_qpack_encoder_set_max_dtable_capacity(&conn->qenc, (size_t)ent->value); break; + + + case NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT: { + dest->enable_web_transport = ent->value; + break; + } + case NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT_DATAGRAM: { + dest->enable_webtransport_datagrams = ent->value; + break; + } + case NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS: if (dest->qpack_blocked_streams != 0) { return NGHTTP3_ERR_H3_SETTINGS_ERROR; diff --git a/lib/nghttp3_frame.h b/lib/nghttp3_frame.h index cca7ed0d..35be1d75 100644 --- a/lib/nghttp3_frame.h +++ b/lib/nghttp3_frame.h @@ -75,6 +75,9 @@ typedef struct nghttp3_frame_headers { #define NGHTTP3_H2_SETTINGS_ID_INITIAL_WINDOW_SIZE 0x4 #define NGHTTP3_H2_SETTINGS_ID_MAX_FRAME_SIZE 0x5 +#define NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT 0x2b603742ULL +#define NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT_DATAGRAM 0xffd277ULL + typedef struct nghttp3_settings_entry { uint64_t id; uint64_t value; diff --git a/lib/nghttp3_stream.c b/lib/nghttp3_stream.c index 82aee818..384450f3 100644 --- a/lib/nghttp3_stream.c +++ b/lib/nghttp3_stream.c @@ -385,6 +385,22 @@ int nghttp3_stream_write_settings(nghttp3_stream *stream, ++fr.settings.niv; } + if (local_settings->enable_web_transport) { + iv[fr.settings.niv] = (nghttp3_settings_entry){ + .id = NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT, + .value = 1, + }; + ++fr.settings.niv; + } + + if (local_settings->enable_webtransport_datagrams) { + iv[fr.settings.niv] = (nghttp3_settings_entry){ + .id = NGHTTP3_SETTINGS_ENABLE_WEBTRANSPORT_DATAGRAM, + .value = 1, + }; + ++fr.settings.niv; + } + len = nghttp3_frame_write_settings_len(&payloadlen, &fr.settings); rv = nghttp3_stream_ensure_chunk(stream, len);