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)
diff --git a/src/session.c b/src/session.c
index 329877d..ae98c94 100644
--- a/src/session.c
+++ b/src/session.c
@@ -264,8 +264,6 @@
}
/* 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 @@
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;