From 1738e86771cce2567483cde0ac23459be8e51ed8 Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Mon, 5 Mar 2018 17:46:16 +0100 Subject: [PATCH] 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) --- src/session.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 329877d29..ae98c9476 100644 --- a/src/session.c +++ b/src/session.c @@ -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 */ - cli_conn->flags |= CO_FL_CONNECTED; - if (conn_complete_session(cli_conn) >= 0) return 1; @@ -402,6 +400,10 @@ static int conn_complete_session(struct connection *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) goto fail;