mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-20 20:50:44 +00:00
BUG/MINOR: connection: Fix fc_http_major and bc_http_major for TCP connections
fc_http_major and bc_http_major sample fetches return the major digit of the HTTP version used, respectively, by the frontend and the backend connections, based on the mux. However, in reality, "2" is returned if the H2 mux is detected, otherwise "1" is inconditionally returned, regardless the mux used. Thus, if called for a raw TCP connection, "1" is returned. To fix this bug, we now get the multiplexer flags, if there is one, to be sure MX_FL_HTX is set. I guess it was made this way on purpose when the H2 multiplexer was introduced in the 1.8 and with the legacy HTTP mode there is no other solution at the connection level. Thus this patch should be backported as far as 2.2. For the 2.0, it must be evaluated first because of the legacy HTTP mode.
This commit is contained in:
parent
fd81848c22
commit
f4dd9ae5c7
@ -1309,6 +1309,8 @@ static int cfg_parse_pp2_never_send_local(char **args, int section_type, struct
|
||||
|
||||
/* return the major HTTP version as 1 or 2 depending on how the request arrived
|
||||
* before being processed.
|
||||
*
|
||||
* WARNING: Should be updated if a new major HTTP version is added.
|
||||
*/
|
||||
static int
|
||||
smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
@ -1316,8 +1318,18 @@ smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *
|
||||
struct connection *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 */
|
||||
if (!conn || (conn->mux && !(conn->mux->flags & MX_FL_HTX)))
|
||||
return 0;
|
||||
|
||||
/* No mux install, this may change */
|
||||
if (!conn->mux) {
|
||||
smp->flags |= SMP_F_MAY_CHANGE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
smp->data.type = SMP_T_SINT;
|
||||
smp->data.u.sint = (conn && strcmp(conn_get_mux_name(conn), "H2") == 0) ? 2 : 1;
|
||||
smp->data.u.sint = (strcmp(conn_get_mux_name(conn), "H2") == 0) ? 2 : 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user