From de3b107cb11a4f6f6464804f1c6ceebbd0490f54 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 24 Jul 2026 11:47:36 +0200 Subject: [PATCH] MINOR: mux-h1: Use htx version to send default low-level errors When an error was returned by the H1 multiplexer, the raw version was used for default low-level errors. It is not really an issue, but it is more consitent to use the HTX version. This way, by default, header names for such errors are now sent in lower case. And the case of header names can still be adjusted if necessary, thanks to the previous fix. It is not really a bug, there is no reason to backport it, except if someone ask for it. --- src/mux_h1.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index a841e9cf3..3d95f042f 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3744,6 +3744,7 @@ static void h1_alert(struct h1s *h1s) static int h1_send_error(struct h1c *h1c) { struct buffer *errmsg = NULL; + struct h1_hdrs_map *hdrs_map = h1_get_hdrs_map(h1c, 1); int rc = http_get_status_idx(h1c->errcode); int ret = 0; @@ -3762,6 +3763,9 @@ static int h1_send_error(struct h1c *h1c) errmsg = h1c->px->replies[rc]->body.errmsg; } + if (!errmsg) + errmsg = &http_err_chunks[rc]; + if (h1c->flags & (H1C_F_OUT_ALLOC|H1C_F_OUT_FULL)) { h1c->flags |= H1C_F_ABRT_PENDING; goto out; @@ -3772,13 +3776,8 @@ static int h1_send_error(struct h1c *h1c) TRACE_STATE("waiting for h1c obuf allocation", H1_EV_H1C_ERR|H1_EV_H1C_BLK, h1c->conn); goto out; } - if (errmsg) { - struct h1_hdrs_map *hdrs_map = h1_get_hdrs_map(h1c, 1); - ret = h1_format_htx_msg(htxbuf(errmsg), &h1c->obuf, hdrs_map); - } - else - ret = b_istput(&h1c->obuf, ist(http_err_msgs[rc])); + ret = h1_format_htx_msg(htxbuf(errmsg), &h1c->obuf, hdrs_map); if (unlikely(ret <= 0)) { if (!ret) { h1c->flags |= (H1C_F_OUT_FULL|H1C_F_ABRT_PENDING); -- 2.47.3