Files
node/lib
James M Snell 44ba289f55 http: add isValidHeaderName() and isValidHeaderValue()
Add non-throwing counterparts of http.validateHeaderName() and
http.validateHeaderValue() that return a boolean instead of throwing.

Rejecting an invalid header with the existing validators costs a few
microseconds, because an error object and its stack trace are created,
compared to ~20ns for the boolean check. Userland HTTP implementations
such as undici (fetch Headers, request options) therefore keep private
copies of the token and field-value tables from _http_common. These new
functions let them reuse the core implementation.

isValidHeaderValue() accepts an optional `httpValidation` option
('strict' or 'relaxed') that has the same meaning as the option of the
same name on http.createServer() and http.request().

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66334
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2026-09-29 04:38:26 +00:00
..
2026-09-03 15:37:21 +00:00
2020-02-18 22:15:50 -08:00
2020-10-21 01:26:34 +02:00
2026-09-05 02:49:02 +00:00
2026-09-28 04:22:37 +00:00
2026-09-12 11:52:10 +00:00
2026-09-03 11:40:52 +02:00
2026-09-15 08:33:52 +00:00
2024-01-12 16:09:48 +00:00
2026-09-12 20:46:35 +00:00
2025-12-22 16:14:46 +00:00
2026-07-25 23:56:46 -07:00
2025-09-04 11:58:50 +00:00
2026-04-01 10:09:41 +00:00
2026-08-23 15:52:12 +00:00
2026-09-03 11:48:46 +02:00
2026-09-11 14:57:09 +00:00