]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: http: define new HTTP status codes for parsers
authorWilly Tarreau <w@1wt.eu>
Tue, 8 Sep 2026 06:47:28 +0000 (08:47 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 8 Sep 2026 12:50:40 +0000 (14:50 +0200)
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.

include/haproxy/http-t.h

index 94bc12670ea76967c4283d34fd16c7c3d1946cb7..837f071de5a81c27e80a95fa1df7315787eaee28 100644 (file)
@@ -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