MINOR: connection: Make bc_http_major compatible with tcp-checks

bc_http_major sample fetch now works when it is called from a
tcp-check. When it happens, the session origin is a check. The backend
connection is retrieved from the conn-stream attached to the check.

If required, this path may easily be backported as far as 2.2.
This commit is contained in:
Christopher Faulet 2021-04-14 15:46:49 +02:00
parent f4dd9ae5c7
commit 242f8ce060

View File

@ -1315,7 +1315,12 @@ static int cfg_parse_pp2_never_send_local(char **args, int section_type, struct
static int
smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct connection *conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
struct connection *conn = NULL;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
/* No connection or a connection with a RAW muxx */