Skip to content

HPACK encoder: filter characters before byte conversion when no chars… - #1544

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:h2-hpack-filter-non-latin1-chars
Dec 2, 2026
Merged

arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:h2-hpack-filter-non-latin1-chars

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

…et encoder is configured

With no CharsetEncoder configured (the default) HPackEncoder and HuffmanEncoder converted header name and value characters to bytes with a plain cast, so a character above 0xFF was written as an unrelated byte (U+010A as LF). Both now use TextUtils#castAsByte, as HTTP/1.1 output has done since 5.2, and write '?' instead.

As with HTTP/1.1, control characters other than HT and characters in the 0x80-0x9F range are replaced as well. Other ISO-8859-1 characters and encoders with a configured charset are not affected.

…et encoder is configured

With no CharsetEncoder configured (the default) HPackEncoder and HuffmanEncoder converted header name and value characters to bytes with a plain cast, so a character above 0xFF was written as an unrelated byte (U+010A as LF). Both now use TextUtils#castAsByte, as HTTP/1.1 output has done since 5.2, and write '?' instead.

As with HTTP/1.1, control characters other than HT and characters in the 0x80-0x9F range are replaced as well. Other ISO-8859-1 characters and encoders with a configured charset are not affected.
@ok2c ok2c added this to the 5.5.1 milestone Nov 29, 2026
@arturobernalg
arturobernalg merged commit 06bcddb into apache:master Dec 2, 2026
12 checks passed
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