From 505adfca51b2e2d83ebfc83ebc25245814621ccc Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 6 Sep 2019 19:08:27 +0200 Subject: [PATCH] MINOR: htx: Add a flag on HTX message to report processing errors 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/common/htx.h b/include/common/htx.h index 32dd1df4c..b2ab1346f 100644 --- a/include/common/htx.h +++ b/include/common/htx.h @@ -144,7 +144,8 @@ /* 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 accordingly to the HTX message */ 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); }