]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http: make smp_fetch_body() report that the contents may change
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Jun 2020 16:01:10 +0000 (18:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Jun 2020 16:16:19 +0000 (18:16 +0200)
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.

src/http_fetch.c

index 585743edf7b76c6709cf6c6ff8a937c978c79961..aece904360da84ad576afd1cb9a900c88ff15123 100644 (file)
@@ -597,6 +597,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;
 }