From df2d1a9bf7f750df69d71294da58261510f5f426 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 15 Jun 2020 18:01:10 +0200 Subject: [PATCH] BUG/MINOR: http: make smp_fetch_body() report that the contents may change The req_body and res_body sample fetch functions forgot to set the SMP_F_MAY_CHANGE flag, making them unusable in tcp content rules. Now we set the flag as long as the channel is not full and nothing indicates the end was reached. This is marked as a bug because it's unusual for a sample fetch function to return a final verdict while data my change, but this results from a limitation that was affecting the legacy mode where it was not possible to know whether the end was reached without de-chunking the message. In HTX there is no more reason to limit this. This fix could be backported to 2.1, and to 2.0 if really needed, though it will only be doable for HTX, and legacy cannot be fixed. (cherry picked from commit 9dc92b2650a83a17db9779eadf63cb011be4f8ff) Signed-off-by: Christopher Faulet --- src/http_fetch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/http_fetch.c b/src/http_fetch.c index 22797e2..2a02b66 100644 --- a/src/http_fetch.c +++ b/src/http_fetch.c @@ -571,6 +571,10 @@ static int smp_fetch_body(const struct arg *args, struct sample *smp, const char smp->data.type = SMP_T_BIN; smp->data.u.str = *temp; smp->flags = SMP_F_VOL_TEST; + + if (!channel_full(chn, global.tune.maxrewrite) && !(chn->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR))) + smp->flags |= SMP_F_MAY_CHANGE; + return 1; } -- 1.7.10.4