This repository was archived by the owner on Apr 22, 2023. It is now read-only.
http: concatenate duplicate headers by default #6821
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently node.js has a list of headers which are allowed to be duplicated, and is dropping any headers that aren't on that list (or start with
x-
). I'm suggesting to do the opposite: build a list of known singular headers and treat others as multiple.Relevant discussion is in issue #2750 (note: I believe a bug with not concatenating DAV still exists).
I took a list of singular headers from firefox source code, since firefox seem to do the same thing I'm suggesting here.
More detailed explanation. There are four kinds of headers:
Content-Type
)Accept
)FooBar
)X-FooBar
)Currently node.js treats 2 & 4 as multiple, and 1 & 3 as singular. Suggested change: treat 2 & 3 & 4 as multiple, 1 as singular.
Current behaviour creates a few issues:
X-
prefix, it is treated as singular one. We can't possibly make a full list of multiple headers, because people can add custom ones.X-
headers and regular ones. There should not be a difference according to RFC 6648. So current behaviour might be confusing, and is clearly violates this part of RFC:Suggested approach will solve all of this at the cost of concatenating unknown singular headers (but those requests are invalid anyway).