Skip to content

fix: close connection when header size is way too large#915

Merged
seanmonstar merged 1 commit into
masterfrom
sean/truvzzqslpmp
Jun 13, 2026
Merged

fix: close connection when header size is way too large#915
seanmonstar merged 1 commit into
masterfrom
sean/truvzzqslpmp

Conversation

@seanmonstar

@seanmonstar seanmonstar commented Jun 12, 2026

Copy link
Copy Markdown
Member

Inspired by the problem highlighted in #912, this will now close a connection if decoded headers are "way" too large.

HPACK requires that we keep decoding no matter what. If a set of headers are larger than the configured limit, we stop saving them, mark them oversize, and then send a RST_STREAM about it. But we keep decoding, because the HPACK table is connection-level state.

The size of the table is bounded, so old entries keep getting evicted. That is fine. But it can mean a lot of CPU usage to ignore them.

This PR says max_header_list_size * 4 is way too big. You go away if you send something way too big.

cc @IgorBelyi this is kind of what I had in mind.

@IgorBelyi

Copy link
Copy Markdown

Nice! So, keep going after the limit until it becomes an annoyance and then close the connection. I'll close my PR in favor of this one. I've confirmed that it solves the problem in my case.

@seanmonstar seanmonstar merged commit 29e209d into master Jun 13, 2026
6 checks passed
@seanmonstar seanmonstar deleted the sean/truvzzqslpmp branch June 13, 2026 11:11
@IgorBelyi

Copy link
Copy Markdown

@seanmonstar Thank you for merging! Is it possible to know the target date when that change be available in the published h2 crate?

@seanmonstar

Copy link
Copy Markdown
Member Author

I was aiming for next Monday to do a release.

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