From: Willy Tarreau Date: Tue, 8 Sep 2026 06:47:28 +0000 (+0200) Subject: MINOR: http: define new HTTP status codes for parsers X-Git-Tag: v3.5-dev7~64 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=2cedce95ce01027a82259825b6b8875ae1600875;p=haproxy.git MINOR: http: define new HTTP status codes for parsers The new http_parser_status enum contains codes for HTTP header field parsers (headers and trailers). This will be used by generic parsers to return accurate error information on what exactly was invalid. --- diff --git a/include/haproxy/http-t.h b/include/haproxy/http-t.h index 94bc12670..837f071de 100644 --- a/include/haproxy/http-t.h +++ b/include/haproxy/http-t.h @@ -110,6 +110,18 @@ enum { HTTP_ERR_SIZE }; +/* HTTP parser error codes */ +enum http_parser_status { + HTTP_PRS_SUCCESS = 0, + HTTP_PRS_INV_HNAME, /* invalid character in header/trailer name */ + HTTP_PRS_INV_HVAL, /* invalid character in header/trailer value */ + HTTP_PRS_PHDR_TRL, /* pseudo-header in trailer */ + HTTP_PRS_FORB_TRL, /* forbidden trailer name */ + HTTP_PRS_TOO_MANY, /* too many header/trailer fields */ + HTTP_PRS_TOO_LARGE, /* failed to add header/trailer (too large hdr block) */ + HTTP_PRS_OTHER, /* other unreferenced error (mostly for default statement) */ +}; + /* Note: the strings below make use of chunks. Chunks may carry an allocated * size in addition to the length. The size counts from the beginning (str) * to the end. If the size is unknown, it MUST be zero, in which case the