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.
(cherry picked from commit d2414a23c4c20b14c54ee9279e99fb96c81a29b1)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit b8aa5f28cea612eadfbd6d775d8402e45a6547c6)
[wt: adjusted ctx]
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 99901e5ccca7ac217c1ea9d86ab41da859e43c94)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
1 file changed