diff --git a/include/haproxy/htx-t.h b/include/haproxy/htx-t.h index 5312ae1e2..a33da886e 100644 --- a/include/haproxy/htx-t.h +++ b/include/haproxy/htx-t.h @@ -177,7 +177,7 @@ static forceinline char *hsl_show_flags(char *buf, size_t len, const char *delim #define HTX_FL_PARSING_ERROR 0x00000001 /* Set when a parsing error occurred */ #define HTX_FL_PROCESSING_ERROR 0x00000002 /* Set when a processing error occurred */ #define HTX_FL_FRAGMENTED 0x00000004 /* Set when the HTX buffer is fragmented */ -/* 0x00000008 unused */ +#define HTX_FL_ALTERED_PAYLOAD 0x00000008 /* The payload is altered, the extra value must not be trusted */ #define HTX_FL_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view * (at worst, on the EOM block is missing) */ diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h index c991c81e5..47893ef1d 100644 --- a/include/haproxy/htx.h +++ b/include/haproxy/htx.h @@ -700,6 +700,8 @@ static inline struct htx *htxbuf(const struct buffer *buf) htx->size = buf->size - sizeof(*htx); htx_reset(htx); } + if (htx->flags & HTX_FL_ALTERED_PAYLOAD) + htx->extra = 0; return htx; } diff --git a/src/filters.c b/src/filters.c index e55adee6b..cc89469ca 100644 --- a/src/filters.c +++ b/src/filters.c @@ -704,6 +704,7 @@ flt_http_payload(struct stream *s, struct http_msg *msg, unsigned int len) *strm_off += ret; end: htx = htxbuf(&msg->chn->buf); + htx->flags |= HTX_FL_ALTERED_PAYLOAD; if (msg->flags & HTTP_MSGF_XFER_LEN) htx->extra = 0; DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_FLT_ANA, s);