Skip to content

Validate all TE header instances for HTTP/2 request conformance.#620

Open
arturobernalg wants to merge 1 commit intoapache:masterfrom
arturobernalg:te
Open

Validate all TE header instances for HTTP/2 request conformance.#620
arturobernalg wants to merge 1 commit intoapache:masterfrom
arturobernalg:te

Conversation

@arturobernalg
Copy link
Member

Reject any TE value other than trailers (including additional TE headers).

@arturobernalg arturobernalg requested a review from ok2c February 16, 2026 10:59
final String value = header.getValue();
if (!"trailers".equalsIgnoreCase(value)) {

for (final String headerName : illegalHeaderNames) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg enhanced for loop creates an extra iterator, which is unnecessary Please keep the simple loop.

@arturobernalg arturobernalg force-pushed the te branch 2 times, most recently from 1699f8f to 1342a90 Compare February 16, 2026 13:51
@arturobernalg arturobernalg requested a review from ok2c February 16, 2026 13:52
"Header '%s: %s' is illegal for HTTP/2 messages", HttpHeaders.TE, token);
}
}
if (!sawAnyToken && request.getFirstHeader(HttpHeaders.TE) != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg This is bad. Why would you want to do a look-up on here, again? You do you need this line at all? If there has been no ProtocolException no exception at this point, everything is OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need some equivalent of sawAnyToken if you want to reject these cases:

  • TE:
  • TE:
  • TE: , , (only separators / whitespace)

Copy link
Member

@ok2c ok2c Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg I do not see a problem with ignoring TE: or TE: . 'TE: , , , ,' however will get correctly rejected.

If you want to eliminate the former two cases as well, I think there is a way of doing without resorting to an extra #getFirstHeader call.

Reject any TE value other than trailers (including additional TE headers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants