]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h1: fix 414 / 431 status code reporting
authorMaximilian Moehl <maximilian@moehl.eu>
Wed, 5 Nov 2025 09:28:12 +0000 (10:28 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Nov 2025 09:55:18 +0000 (10:55 +0100)
The more detailed status code reporting introduced with bc967758a2 is
checking against the error state to determine whether it is a too long
URL or too large headers. The check used always returns true which
results in a 414 as the error state is only set at a later point.

This commit adjusts the check to use the current state instead to return
the intended status code.

This patch must be backported as far as 3.1.

src/h1_htx.c

index 1e67b63c396e58fc8aac9a10c4c72bbcba601c91..fcef42ac00b28a45df0d75fe973d744242f50ab8 100644 (file)
@@ -397,7 +397,7 @@ int h1_parse_msg_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx *dsthtx,
                        goto error;
                if (!ret && !ofs && !buf_room_for_htx_data(srcbuf)) {
                        if (!(h1m->flags & H1_MF_RESP))
-                               h1m->err_code = (h1m->err_state < H1_MSG_HDR_FIRST) ? 414: 431;
+                               h1m->err_code = (h1m->state < H1_MSG_HDR_FIRST) ? 414: 431;
                        goto error;
                }
                goto end;