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;