From: Willy Tarreau Date: Wed, 22 Apr 2026 09:58:15 +0000 (+0200) Subject: BUG/MINOR: mux-h2: count a protocol error when failing to parse a trailer X-Git-Tag: v3.4-dev10~108 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=c73a81469e4ae5a6679bf6d78127683bdf7981c6;p=haproxy.git BUG/MINOR: mux-h2: count a protocol error when failing to parse a trailer Commit aab1a60977 ("BUG/MEDIUM: h2/htx: always fail on too large trailers") explicitly returned an RST_STREAM on failure to decode some trailers, and used the code H2_ERR_INTERNAL_ERROR. However there are multiple possible causes for this failure to happen, and it turns out that it's much more likely to be related to a protocol error than a decompression error. So let's change this to PROTOCOL_ERROR, and count a protocol error on the proxy and in the session. This can be backported to all stable versions (with adjustments related to these versions, maybe focusing on 3.2 max is reasonable). --- diff --git a/src/mux_h2.c b/src/mux_h2.c index e8aeaca46..99a6be282 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3561,8 +3561,10 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s) /* Failed to decode this frame (e.g. too large request) * but the HPACK decompressor is still synchronized. */ + session_inc_http_err_ctr(h2c->conn->owner); + HA_ATOMIC_INC(&h2c->px_counters->strm_proto_err); h2_sess_log_strm(h2c->conn->owner); - h2s_error(h2s, H2_ERR_INTERNAL_ERROR); + h2s_error(h2s, H2_ERR_PROTOCOL_ERROR); TRACE_USER("Stream error decoding H2 trailers", H2_EV_RX_FRAME|H2_EV_RX_HDR|H2_EV_STRM_NEW|H2_EV_STRM_END, h2c->conn, 0, h2s_rxbuf_tail(h2s)); h2c->st0 = H2_CS_FRAME_E; goto out;