BUG/MINOR: session: Fix tcp-request session failure if handshake.

Some sample fetches check if session is established using
the flag CO_FL_CONNECTED. But in some cases, when a handshake
is performed this flag is set too late, after the process
of the tcp-request session rules.

This fix move the raising of the flag at the beginning of the
conn_complete_session function which processes the tcp-request
session rules.

This fix must be backported to 1.8 (and perhaps 1.7)
This commit is contained in:
Emeric Brun 2018-03-05 17:46:16 +01:00 committed by Willy Tarreau
parent b684e7a52c
commit 1738e86771

View File

@ -264,8 +264,6 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
} }
/* OK let's complete stream initialization since there is no handshake */ /* OK let's complete stream initialization since there is no handshake */
cli_conn->flags |= CO_FL_CONNECTED;
if (conn_complete_session(cli_conn) >= 0) if (conn_complete_session(cli_conn) >= 0)
return 1; return 1;
@ -402,6 +400,10 @@ static int conn_complete_session(struct connection *conn)
conn_clear_xprt_done_cb(conn); conn_clear_xprt_done_cb(conn);
/* Verify if the connection just established. */
if (unlikely(!(conn->flags & (CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN | CO_FL_CONNECTED))))
conn->flags |= CO_FL_CONNECTED;
if (conn->flags & CO_FL_ERROR) if (conn->flags & CO_FL_ERROR)
goto fail; goto fail;