BUG/MINOR: http-fetch: Make method smp safe if headers were already forwarded
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 15 Apr 2021 07:28:02 +0000 (09:28 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 19 Apr 2021 06:31:05 +0000 (08:31 +0200)
commit6f97a611c83d7135d77407f7327980994413b842
treea92f96f1b7a8afab19029cc78e7ba3ca385254ad
parent4bef8d1d46ba596f1cc1595a63a01b6d9ae0f6cc
BUG/MINOR: http-fetch: Make method smp safe if headers were already forwarded

When method sample fetch is called, if an exotic method is found
(HTTP_METH_OTHER), when smp_prefetch_htx() is called, we must be sure the
start-line is still there. Otherwise, HAproxy may crash because of a NULL
pointer dereference, for instance if the method sample fetch is used inside
a unique-id format string. Indeed, the unique id may be generated when the
log message is emitted. At this stage, the request channel is empty.

This patch must be backported as far as 2.0. But the bug exists in all
stable versions for the legacy HTTP mode too. Thus it must be adapted to the
legacy HTTP mode and backported to all other stable versions.
src/http_fetch.c