From 2bfc82ba1a226ccd1c5578dd81ab838229aacbf2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 9 Sep 2026 13:40:52 +0200 Subject: [PATCH] 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" --- src/h1_htx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- 2.47.3