MEDIUM: connections: Introduce a handshake pseudo-XPRT.

Add a new XPRT that is used when using non-SSL handshakes, such as proxy
protocol or Netscaler, instead of taking care of it in conn_fd_handler().
This XPRT is installed when any of those is used, and it removes itself once
the handshake is done.
This should allow us to remove the distinction between CO_FL_SOCK* and
CO_FL_XPRT*.
diff --git a/src/backend.c b/src/backend.c
index cfd2462..36936a5 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1213,6 +1213,7 @@
 	int reuse_orphan = 0;
 	int init_mux = 0;
 	int alloced_cs = 0;
+	int flags_hs = 0;
 	int err;
 
 
@@ -1483,6 +1484,7 @@
 			return SF_ERR_INTERNAL;
 	}
 
+	flags_hs = srv_conn->flags & CO_FL_HANDSHAKE_NOSSL;
 	if (!conn_xprt_ready(srv_conn) && !srv_conn->mux) {
 		/* set the correct protocol on the output stream interface */
 		if (srv)
@@ -1590,6 +1592,15 @@
 		    srv_conn->mux->avail_streams(srv_conn) > 0)
 			LIST_ADD(&srv->idle_conns[tid], &srv_conn->list);
 	}
+	/* The CO_FL_SEND_PROXY flag may have been set by the connect method,
+	 * if so, add our handshake pseudo-XPRT now.
+	 */
+	if (!flags_hs && (srv_conn->flags & CO_FL_SEND_PROXY)) {
+		if (xprt_add_hs(srv_conn) < 0) {
+			conn_full_close(srv_conn);
+			return SF_ERR_INTERNAL;
+		}
+	}
 
 
 #if USE_OPENSSL && (defined(OPENSSL_IS_BORINGSSL) || (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L))