From 0fccfa421ba25754f109ef58f7d64eca89c93180 Mon Sep 17 00:00:00 2001 From: Tim Perry <1526883+pimterry@users.noreply.github.com> Date: Sat, 21 Feb 2026 23:58:52 +0100 Subject: [PATCH] http2: add strictSingleValueFields option to relax header validation Previously it was impossible to send multiple values for any header or trailer defined officially as supporting only a single value. This is a good default, but in practice many of these headers are used in weird & wonderful ways where this can be problematic. This new option allows for relaxing this restriction to support those cases where required. This option defaults to true so validation will still be applied as before, rejecting multiple single-value fields, unless explicitly disabled. PR-URL: https://github.com/nodejs/node/pull/59917 Reviewed-By: Stephen Belanger --- doc/api/http2.md | 14 ++++ lib/internal/http2/core.js | 58 ++++++++++++--- lib/internal/http2/util.js | 29 +++++--- lib/internal/quic/quic.js | 8 ++- ...ttp2-single-headers-validation-disabled.js | 53 ++++++++++++++ ...> test-http2-single-headers-validation.js} | 0 ...st-http2-util-assert-valid-pseudoheader.js | 18 ++--- test/parallel/test-http2-util-headers-list.js | 72 ++++++++++++++----- 8 files changed, 208 insertions(+), 44 deletions(-) create mode 100644 test/parallel/test-http2-single-headers-validation-disabled.js rename test/parallel/{test-http2-single-headers.js => test-http2-single-headers-validation.js} (100%) diff --git a/doc/api/http2.md b/doc/api/http2.md index 4663c7400b3..19540a95a52 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2796,6 +2796,9 @@ Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument.