]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: htx: Add a flag on HTX message to report processing errors
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Sep 2019 17:08:27 +0000 (19:08 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Sep 2019 08:18:54 +0000 (10:18 +0200)
This new flag may be used to report unexpected error because of not well
formatted HTX messages (not related to a parsing error) or our incapactity to
handle the processing because we reach a limit (ressource exhaustion, too big
headers...). It should result to an error 500 returned to the client when
applicable.

include/common/htx.h

index 32dd1df4c0111a2df85068d835b060cd14573418..b2ab1346f82ae2e6507acca43474d02455875da4 100644 (file)
 /* HTX flags */
 #define HTX_FL_NONE              0x00000000
 #define HTX_FL_PARSING_ERROR     0x00000001 /* Set when a parsing error occurred */
-#define HTX_FL_UPGRADE           0x00000002 /* Set when an upgrade is in progress */
+#define HTX_FL_PROCESSING_ERROR  0x00000002 /* Set when a processing error occurred */
+#define HTX_FL_UPGRADE           0x00000004 /* Set when an upgrade is in progress */
 
 
 /* HTX block's type (max 15). */
@@ -753,7 +754,8 @@ static inline struct htx *htx_from_buf(struct buffer *buf)
 /* Update <buf> accordingly to the HTX message <htx> */
 static inline void htx_to_buf(struct htx *htx, struct buffer *buf)
 {
-       if ((htx->head == -1) && !(htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_UPGRADE))) {
+       if ((htx->head == -1) &&
+           !(htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR|HTX_FL_UPGRADE))) {
                htx_reset(htx);
                b_set_data(buf, 0);
        }