Skip to content

Apply the acknowledged HTTP/2 header table size to the decoding table - #508

Merged
ericmj merged 2 commits into
mainfrom
use-hpax-protocol-resize
Sep 24, 2026
Merged

ericmj merged 2 commits into
mainfrom
use-hpax-protocol-resize

Conversation

@ericmj

@ericmj ericmj commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

put_settings/2 documents and accepts :header_table_size, but @valid_client_settings didn't list it, so when the server acknowledged the SETTINGS frame the reduce in apply_client_settings/2 fell through to the catch-all and raised RuntimeError out of stream/2: "received ack from server for invalid client setting: :header_table_size". The setting is now recorded and the decoding table's permitted maximum follows it.

That maximum is a limit, not the size of the table. The table's own maximum belongs to the server's encoder, which declares it with a dynamic table size update (RFC 7541 4.2), and HPAX.resize/2 moves both. With the server on a 64 byte table holding :status: 404, a raise to 8192, and the server then storing :status: 500, which evicts 404 from its own table, an indexed reference to entry 63 would decode to the stale 404. With HPAX.protocol_resize/2 it's {:compression_error, "unable to decode headers: {:index_not_found, 63}"}.

protocol_resize/2 also follows the limit down when it drops below the size the encoder declared. After such a reduction the server has to declare its new size at the start of the next field block, which RFC 9113 4.3.1 requires the client to treat as a connection error of type COMPRESSION_ERROR if it doesn't, so a block that skips it is {:compression_error, "unable to decode headers: :missing_size_update"}.

protocol_resize/2 was added in hpax 1.1.0, so the second commit raises the requirement to ~> 1.1. Mint no longer accepts hpax 0.1, 0.2 or 1.0.

Four tests: the setting being applied and usable, the two cases above, and a control where the server does declare the reduced size and the response is accepted. The two error cases fail against HPAX.resize/2; all four fail without the change, the setting test with the RuntimeError above.

@coveralls

coveralls commented Sep 21, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 1

Coverage increased (+0.01%) to 88.539%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1745
Covered Lines: 1545
Line Coverage: 88.54%
Coverage Strength: 559.26 hits per line

馃挍 - Coveralls

@ericmj
ericmj force-pushed the apply-http2-client-settings branch from 6184a56 to 48a0066 Compare September 21, 2026 11:02
@ericmj
ericmj force-pushed the use-hpax-protocol-resize branch from f79a60a to 8f1e396 Compare September 21, 2026 11:03
@ericmj ericmj changed the title DO NOT MERGE: Apply the HTTP/2 header table size to the decoding table as a limit DO NOT MERGE: Apply the acknowledged HTTP/2 header table size to the decoding table Sep 21, 2026

@whatyouhide whatyouhide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

Base automatically changed from apply-http2-client-settings to main September 24, 2026 09:36
put_settings/2 accepted :header_table_size but the handler for the
server's SETTINGS ACK didn't know the setting and raised a RuntimeError
out of stream/2. The setting is now recorded and the HPACK decoding
table's permitted maximum follows it.

That maximum is a limit rather than the size of the table. The table's
own maximum belongs to the server's encoder, which declares it with a
dynamic table size update (RFC 7541 4.2), so HPAX.resize/2, which moves
both, would keep entries the server had evicted and decode an indexed
reference to one of them as a stale header.
HPAX.protocol_resize/2 moves only the limit and follows it down when it
drops below the size the encoder declared. After a reduction the server
has to declare its new size at the start of the next field block, which
RFC 9113 4.3.1 requires the client to enforce, so a block that doesn't
is a connection error with COMPRESSION_ERROR.
HPAX.protocol_resize/2 was added in hpax 1.1.0, so older versions can't
be used anymore.
@ericmj
ericmj force-pushed the use-hpax-protocol-resize branch from 8f1e396 to 1e2a5f7 Compare September 24, 2026 09:50
@ericmj ericmj changed the title DO NOT MERGE: Apply the acknowledged HTTP/2 header table size to the decoding table Apply the acknowledged HTTP/2 header table size to the decoding table Sep 24, 2026
@ericmj
ericmj merged commit 71dd925 into main Sep 24, 2026
3 checks passed
@ericmj
ericmj deleted the use-hpax-protocol-resize branch September 24, 2026 09:55
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.

3 participants