From: Christopher Faulet Date: Mon, 7 Sep 2026 05:58:21 +0000 (+0200) Subject: MINOR: htx: Add function to know if the tail block carry EOM flag X-Git-Tag: v3.5-dev8~159 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=718883b069dfa4b9b2832c7087b8ea115ef3be5b;p=haproxy.git MINOR: htx: Add function to know if the tail block carry EOM flag htx_has_eom() function can now be used to know if the tail block of a message carry the HTX_BLK_FL_EOM flag, so to know if the current HTX message contains the end of the message. htx_expect_more() function relies on it. --- diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h index 0245653ad..6a2701255 100644 --- a/include/haproxy/htx.h +++ b/include/haproxy/htx.h @@ -821,14 +821,26 @@ static inline int htx_is_empty_noerr(const struct htx *htx) return (htx_is_empty(htx) && !(htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR))); } +/* Return true if the htx message is not empty and HTX_FL_HAS_EOM flag is set on + * the tail block. Otherwise, false is returned. + */ +static inline int htx_has_eom(const struct htx *htx) +{ + struct htx_blk *blk = htx_get_tail_blk(htx); + + /* htx_remove_blk() must take care to never leave unused blocks on head and tail of the message */ + BUG_ON_HOT(blk && (blk->flags & HTX_BLK_FL_EOM) && htx_get_blk_type(blk) == HTX_BLK_UNUSED); + return (blk != NULL && !!(blk->flags & HTX_BLK_FL_EOM)); +} + /* Returns 1 if more data are expected for the message . Otherwise it * returns 0. Note that it is illegal to call this with htx == NULL. This - * function relies on the HTX_FL_HAS_EOM flags. It means tunneled data are - * not considered here. + * function relies on htx_has_eom() function. It means more data are always + * expected on tunnel mode. */ static inline int htx_expect_more(const struct htx *htx) { - return !(htx->flags & HTX_FL_HAS_EOM); + return !htx_has_eom(htx); } /* Set EOM flag in . This function must always be called to report the end