From ed3edd45107b31ac22e5bce5db9cf56edd846fa8 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 17 Sep 2025 18:32:58 +0200 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. --- 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 2893b605e7e437..00796b52be8789 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2792,6 +2792,9 @@ Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument.