]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: http-fetch: Don't set the sample type during the htx prefetch
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2020 08:19:02 +0000 (10:19 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2020 09:06:24 +0000 (11:06 +0200)
commitd2414a23c4c20b14c54ee9279e99fb96c81a29b1
treee6fedc45836675b5a6f812da8a4e44c64523e437
parent3ca2365904062f883751a4099e2eb5e47ecf11b7
BUG/MINOR: http-fetch: Don't set the sample type during the htx prefetch

A subtle bug was introduced by the commit a6d9879e6 ("BUG/MEDIUM: htx:
smp_prefetch_htx() must always validate the direction"), for the "method"
sample fetch only. The sample data type and the method id are always
overwritten because smp_prefetch_htx() function is called later in the
sample fetch evaluation. The bug is in the smp_prefetch_htx() function but
it is only visible for the "method" sample fetch, for an unknown method.

In fact, when smp_prefetch_htx() is called, the sample object is
altered. The data type is set to SMP_T_BOOL and, on success, the data value
is set to 1.  Thus, if the caller has already set some infos into the sample
object, they may be lost. AFAIK, there is no reason to do so. It is
inherited from the legacy HTTP code and I honestely don't known why it was
done this way. So, instead of fixing the "method" sample fetch to set useful
info after the call to smp_prefetch_htx() function, I prefer to not alter
the sample object in smp_prefetch_htx().

This patch must be backported as far as 2.0. On the 2.0, only the HTX part
must be fixed.
src/http_fetch.c