Skip to content

Commit 4496950

Browse files
net.http: emit HPACK Dynamic Table Size Update in H2MuxConn apply_peer_settings
RFC 7541 §6.3 requires that when the peer sends SETTINGS_HEADER_TABLE_SIZE, the encoder MUST emit a Dynamic Table Size Update prefix at the start of the next HEADERS block, even when the encoder uses only literals. The h2_settings_header_table_size arm in H2MuxConn.apply_peer_settings was comment-only, so pending_max_table_size was never set and no update was ever emitted. Add the same set_max_size + pending_max_table_size assignment that H2Conn.apply_settings and H2ServerConn.apply_settings already perform, guarded by wmu since H2MuxConn has concurrent writers. Co-Authored-By: WOZCODE <contact@withwoz.com>
1 parent 5be13c6 commit 4496950

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

vlib/net/http/h2_mux_conn.v

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,14 +1125,14 @@ fn (mut c H2MuxConn) apply_peer_settings(settings []H2Setting) ! {
11251125
for st in settings {
11261126
match st.id {
11271127
h2_settings_header_table_size {
1128-
// The peer's HEADER_TABLE_SIZE bounds the dynamic table our
1129-
// *encoder* may use when compressing request headers (the table
1130-
// the server uses to decode them) — it does not change the table
1131-
// we advertised for decoding the server's responses. Our encoder
1132-
// never uses HPACK dynamic indexing (only static entries and
1133-
// literals), so there is nothing to constrain; applying this to
1134-
// c.decoder would wrongly shrink our response-decode table and
1135-
// break valid dynamic references in the server's responses.
1128+
// RFC 7541 §6.3: even if our encoder uses only literals, we MUST
1129+
// emit a Dynamic Table Size Update prefix at the start of the next
1130+
// HEADERS block when the peer lowers this limit. encode() emits
1131+
// the update when pending_max_table_size >= 0.
1132+
c.wmu.lock()
1133+
c.encoder.dyn_table.set_max_size(int(st.value))
1134+
c.encoder.pending_max_table_size = int(st.value)
1135+
c.wmu.unlock()
11361136
}
11371137
h2_settings_enable_push {
11381138
if st.value > 1 {

0 commit comments

Comments
 (0)