Skip to content

Commit 84a29f3

Browse files
committed
fixup! http: support lenient header value validation via insecureHTTPParser
Address review nits from jasnell: - Clarify that strict regex is the original/default behavior - Use falsy check for insecureHTTPParser on server
1 parent 896def4 commit 84a29f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/_http_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function checkIsHttpToken(val) {
256256
return true;
257257
}
258258

259-
// Strict header value regex per RFC 7230:
259+
// Strict header value regex per RFC 7230 (original/default behavior):
260260
// field-value = *( field-content / obs-fold )
261261
// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
262262
// field-vchar = VCHAR / obs-text

lib/_http_outgoing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ OutgoingMessage.prototype._isLenientHeaderValidation = function() {
169169
return this.insecureHTTPParser;
170170
}
171171
// ServerResponse can access via req.socket.server
172-
if (this.req?.socket?.server?.insecureHTTPParser !== undefined) {
172+
if (this.req?.socket?.server?.insecureHTTPParser) {
173173
return this.req.socket.server.insecureHTTPParser;
174174
}
175175
// Fall back to global option

0 commit comments

Comments
 (0)