Repository navigation
Ignore HTTP/1.1 response header fields whose name is not a token - #1249
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
RFC 9110, section 5.1 requires a field name to be a token. HTTP/2 response headers and HTTP/1.1 trailer fields already drop invalid names. HTTP/1.1 response headers still wrote them, so a name such as "bad name" or "X:Y" produced an invalid or misleading header line. Remove such header fields and log them, as is already done for header fields that cannot be written.
arturobernalg
force-pushed
the
response-invalid-header-name
branch
from
November 17, 2026 19:11
dce8f8b to
0fda29e
Compare
Member
Author
|
Reworked now that #1154 is merged: the check moved from Response to Http11Processor.writeHeaders(), so it only covers HTTP/1.1 response headers, the case still missing. |
Contributor
|
Indeed, when you start accepting one of these, you have to add all of them. Great. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RFC 9110, section 5.1 requires a field name to be a token. After #1154 and its follow-up, HTTP/2 response headers and HTTP/1.1 trailer fields drop invalid names, but HTTP/1.1 response headers still write them as is. A name such as "bad name" or "X:Y" produces an invalid or misleading header line.
This removes such header fields in Http11Processor.writeHeaders() and logs them with the existing http11processor.response.invalidHeader message, as is already done for header fields that cannot be written.
Checked against a running Tomcat: before the change the HTTP/1.1 response contained "bad name: v1", "x(y): v2" and "X:Y: v4"; with it they are removed and logged, while valid fields are unchanged. The new test in TestHttp11Processor fails without the fix.