From dbe0b371eee40bf010bf7b2c418f0d60b6912ca2 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 17 May 2026 05:36:55 -0700 Subject: [PATCH] quic: handle h3 max header size option Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/63483 Backport-PR-URL: https://github.com/nodejs/node/pull/64675 Reviewed-By: Stephen Belanger Reviewed-By: Matteo Collina --- src/quic/application.cc | 7 +++++++ src/quic/session.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/quic/application.cc b/src/quic/application.cc index c37b22c2bd3..6e8df41fc9a 100644 --- a/src/quic/application.cc +++ b/src/quic/application.cc @@ -115,6 +115,13 @@ Maybe Session::Application_Options::From( #undef SET + // Ensure the advertised max_field_section_size in SETTINGS is at least + // as large as max_header_length. Otherwise the peer would be told to + // restrict headers to a smaller size than what CanAddHeader accepts. + if (options.max_field_section_size < options.max_header_length) { + options.max_field_section_size = options.max_header_length; + } + return Just(options); } diff --git a/src/quic/session.h b/src/quic/session.h index 9fb67fb918d..7fb897684ef 100644 --- a/src/quic/session.h +++ b/src/quic/session.h @@ -72,7 +72,11 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source { uint64_t max_header_length = DEFAULT_MAX_HEADER_LENGTH; // HTTP/3 specific options. - uint64_t max_field_section_size = 0; + // The maximum header section size advertised to the peer in SETTINGS. + // Defaults to match max_header_length so the SETTINGS frame accurately + // reflects the enforcement limit. A value of 0 would incorrectly tell + // the peer not to send any headers at all. + uint64_t max_field_section_size = DEFAULT_MAX_HEADER_LENGTH; uint64_t qpack_max_dtable_capacity = 4096; uint64_t qpack_encoder_max_dtable_capacity = 4096; uint64_t qpack_blocked_streams = 100;