Skip to content

Commit 49462ec

Browse files
RajeshKumar11aduh95
authored andcommitted
http: add httpValidation option to configure header value validation
Add a new httpValidation option to http.createServer() and http.request() / http.ClientRequest that controls how strictly HTTP header values are validated: - 'strict' - reject any non-ASCII or control characters (default) - 'relaxed' - allow the non-ASCII characters permitted by the Fetch specification (kLenientHeaderValueRelaxed) - 'insecure' - disable all validation (like insecureHTTPParser) The option is threaded through _storeHeader -> processHeader -> storeHeader -> validateHeaderValue, and also through writeInformation -> processInformationHeader -> validateHeaderValue. Cannot be used together with insecureHTTPParser. Fixes: #61582 Signed-off-by: RajeshKumar11 <kakumanurajeshkumar@gmail.com> PR-URL: #61597 Refs: #61582 Refs: https://fetch.spec.whatwg.org/#header-value Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 4da442f commit 49462ec

8 files changed

Lines changed: 668 additions & 53 deletions

File tree

‎doc/api/http.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3662,6 +3662,9 @@ Found'`.
36623662
<!-- YAML
36633663
added: v0.1.13
36643664
changes:
3665+
- version: REPLACEME
3666+
pr-url: https://github.com/nodejs/node/pull/61597
3667+
description: The `httpValidation` option is supported now.
36653668
- version:
36663669
- v25.1.0
36673670