Skip to content

fix(h1): append duplicate trailer values when encoding (match #4107)#4118

Merged
seanmonstar merged 1 commit into
hyperium:masterfrom
greymoth-jp:fix/encode-trailers-append-duplicate-values
Jun 29, 2026
Merged

fix(h1): append duplicate trailer values when encoding (match #4107)#4118
seanmonstar merged 1 commit into
hyperium:masterfrom
greymoth-jp:fix/encode-trailers-append-duplicate-values

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

#4107 fixed the decode side: decode_trailers switched from HeaderMap::insert to append, so repeated trailer values received on the wire are preserved. The encode side is the unfixed sibling: Encoder::encode_trailers (src/proto/h1/encode.rs) builds allowed_trailers with insert, so when a user sets the same trailer field multiple times, only the last value reaches the wire.

The one-line fix mirrors #4107 (insertappend). Verified both ways with cargo test --features full: a regression test fails on the old code (only the second value reaches the wire) and passes after; encode module 10/10, full lib suite 100 passed, 0 regression.

The chunked trailer encoder built allowed_trailers with HeaderMap::insert,
which overwrites prior values for the same name. When a user sets the same
trailer field multiple times, only the last value was written to the wire.

This mirrors the decode-side fix (hyperium#4107): use append so duplicate trailer
values are preserved on encode, matching how regular headers are emitted.
@greymoth-jp greymoth-jp force-pushed the fix/encode-trailers-append-duplicate-values branch from 4784da1 to f33e042 Compare June 28, 2026 13:03

@seanmonstar seanmonstar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@seanmonstar seanmonstar merged commit de1483d into hyperium:master Jun 29, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants