From: Willy Tarreau Date: Wed, 9 Sep 2026 11:40:52 +0000 (+0200) Subject: MEDIUM: h1: switch to the generic trailers parser X-Git-Tag: v3.5-dev7~34 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=2bfc82ba1a226ccd1c5578dd81ab838229aacbf2;p=haproxy.git MEDIUM: h1: switch to the generic trailers parser Let's now use http_trailers_to_htx() instead of htx_add_all_trailers() to parse HTTP/1 trailers. Upper case is permitted and thats the only difference with H2/H3 for now. The parser is stricter than the previous function, so the following names are now rejected as it is for other versions: "host", "content-length", "connection", "proxy-connection" "keep-alive", "upgrade", "te", "transfer-encoding" --- diff --git a/src/h1_htx.c b/src/h1_htx.c index 5b112d2f8..5aa3ad4a8 100644 --- a/src/h1_htx.c +++ b/src/h1_htx.c @@ -978,6 +978,7 @@ int h1_parse_msg_tlrs(struct h1m *h1m, struct htx *dsthtx, { struct http_hdr hdrs[global.tune.max_http_hdr]; struct h1m tlr_h1m; + uint parser_flags; int ret = 0; if (b_data(srcbuf) == ofs) { @@ -1014,7 +1015,10 @@ int h1_parse_msg_tlrs(struct h1m *h1m, struct htx *dsthtx, goto output_full; } - if (!htx_add_all_trailers(dsthtx, hdrs)) + parser_flags = HTTP_PF_UPCASE_OK; + parser_flags |= (h1m->flags & H1_MF_RESP) ? HTTP_PF_DIR_RES : 0; + + if (http_trailers_to_htx(hdrs, dsthtx, parser_flags) != HTTP_PRS_SUCCESS) goto error; h1m->state = H1_MSG_DONE;