From: Willy Tarreau Date: Wed, 4 Nov 2026 16:37:11 +0000 (+0100) Subject: MINOR: http: use ist_find_http_ctl() instead of ist_find_ctl() X-Git-Tag: v3.5-dev11~38 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=48d3fcd7d67ab0325f81bd71016f314bb2370706;p=haproxy.git MINOR: http: use ist_find_http_ctl() instead of ist_find_ctl() At a few places we were using ist_find_ctl() as an accelerator to locate possibly forbidden CTL chars, but that one doesn't detect the DEL char, so now that we have the new ist_find_http_ctl(), let's use it instead. This is not tagged as a bug because nothing at this point is made with this char so this doesn't make a difference at this point. --- diff --git a/include/haproxy/http.h b/include/haproxy/http.h index aebc524ea..5bb15a787 100644 --- a/include/haproxy/http.h +++ b/include/haproxy/http.h @@ -186,7 +186,7 @@ static inline struct http_uri_parser http_uri_parser_init(const struct ist uri) * 0x0D), starting at pointer which must be within . Returns * non-zero if such a character is found, 0 otherwise. When run on unlikely * header match, it's recommended to first check for the presence of control - * chars using ist_find_ctl(). + * chars using ist_find_http_ctl(). */ static inline int http_header_has_forbidden_char(const struct ist ist, const char *start) { @@ -218,7 +218,7 @@ static inline int http_method_has_forbidden_char(const struct ist ist) * 0x20, 0x23), starting at pointer which must be within . * Returns non-zero if such a character is found, 0 otherwise. When run on * unlikely header match, it's recommended to first check for the presence - * of control chars using ist_find_ctl(). + * of control chars using ist_find_http_ctl(). */ static inline int http_path_has_forbidden_char(const struct ist ist, const char *start) { diff --git a/src/h2.c b/src/h2.c index 2456998e8..bad6f57e9 100644 --- a/src/h2.c +++ b/src/h2.c @@ -367,7 +367,7 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms if (unlikely(ctl) && http_path_has_forbidden_char(list[idx].v, ctl)) goto fail; } else { - ctl = ist_find_ctl(list[idx].v); + ctl = ist_find_http_ctl(list[idx].v); if (unlikely(ctl) && http_header_has_forbidden_char(list[idx].v, ctl)) goto fail; } @@ -685,7 +685,7 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m /* RFC7540#10.3: intermediaries forwarding to HTTP/1 must take care of * rejecting NUL, CR and LF characters. */ - ctl = ist_find_ctl(list[idx].v); + ctl = ist_find_http_ctl(list[idx].v); if (unlikely(ctl) && http_header_has_forbidden_char(list[idx].v, ctl)) goto fail; diff --git a/src/h3.c b/src/h3.c index d8cf0c281..aad29a72c 100644 --- a/src/h3.c +++ b/src/h3.c @@ -563,7 +563,7 @@ static int h3_set_authority(struct qcs *qcs, struct ist *auth, const struct ist static int _h3_handle_phdr(struct qcs *qcs, const struct http_hdr *h) { /* look for forbidden control characters in the pseudo-header value */ - const char *ctl = ist_find_ctl(h->v); + const char *ctl = ist_find_http_ctl(h->v); if (unlikely(ctl) && http_header_has_forbidden_char(h->v, ctl)) { TRACE_ERROR("control character present in pseudo-header value", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs); goto err; @@ -610,7 +610,7 @@ static int _h3_handle_hdr(struct qcs *qcs, const struct http_hdr *hdr) */ /* look for forbidden control characters in the header value */ - ctl = ist_find_ctl(value); + ctl = ist_find_http_ctl(value); if (unlikely(ctl) && http_header_has_forbidden_char(value, ctl)) { TRACE_ERROR("control character present in header value", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs); goto err; diff --git a/src/http_htx.c b/src/http_htx.c index 8dbe1bd63..2c1e5cd6f 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -2062,7 +2062,7 @@ enum http_parser_status http_trailers_to_htx(struct http_hdr *list, struct htx * * response that contains a character not permitted in a field * value MUST be treated as malformed */ - ctl = ist_find_ctl(list[idx].v); + ctl = ist_find_http_ctl(list[idx].v); if (unlikely(ctl) && http_header_has_forbidden_char(list[idx].v, ctl)) { ret = HTTP_PRS_INV_HVAL; goto fail;