]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Use htx version to send default low-level errors
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2026 09:47:36 +0000 (11:47 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2026 09:56:56 +0000 (11:56 +0200)
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

index a841e9cf313b303b297b543c486362fc0162a5cb..3d95f042f367ac45f147cd10dab10846fbdcf5a3 100644 (file)
@@ -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);