MINOR: connection: add alternative mux_ops param for conn_install_mux_be

Add a new parameter force_mux_ops. This will be useful to specify an
alternative to the srv->mux_proto field. If non-NULL, it will be use to
force the mux protocol wether srv->mux_proto is set or not.

This argument will become useful to install a mux for non-standard
streams, most notably websocket streams.

(cherry picked from commit ac03ef26e8b81461c2585cc42c1bbaa2ceb878ee)
[ad: move function from connection.c to connection.h]
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h
index fddda03..4b8b098 100644
--- a/include/haproxy/connection.h
+++ b/include/haproxy/connection.h
@@ -1070,7 +1070,8 @@
  * <ctx>. If the mux protocol is forced, we use it to find the best mux. Returns
  * < 0 on error.
  */
-static inline int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess)
+static inline int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess,
+                                      const struct mux_ops *force_mux_ops)
 {
 	struct server *srv = objt_server(conn->target);
 	struct proxy  *prx = objt_proxy(conn->target);
@@ -1082,8 +1083,12 @@
 	if (!prx) // target must be either proxy or server
 		return -1;
 
-	if (srv && srv->mux_proto)
+	if (srv && srv->mux_proto && likely(!force_mux_ops)) {
 		mux_ops = srv->mux_proto->mux;
+	}
+	else if (srv && unlikely(force_mux_ops)) {
+		mux_ops = force_mux_ops;
+	}
 	else {
 		struct ist mux_proto;
 		const char *alpn_str = NULL;
diff --git a/src/backend.c b/src/backend.c
index 3641f78..1701304 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1654,7 +1654,7 @@
 	 * fail, and flag the connection as CO_FL_ERROR.
 	 */
 	if (init_mux) {
-		if (conn_install_mux_be(srv_conn, srv_cs, s->sess) < 0) {
+		if (conn_install_mux_be(srv_conn, srv_cs, s->sess, NULL) < 0) {
 			conn_full_close(srv_conn);
 			return SF_ERR_INTERNAL;
 		}
diff --git a/src/connection.c b/src/connection.c
index f1a2c18..9e710c3 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -61,7 +61,7 @@
 			if (conn_install_mux_chk(conn, conn->ctx, sess) < 0)
 				goto fail;
 		}
-		else if (conn_install_mux_be(conn, conn->ctx, sess) < 0)
+		else if (conn_install_mux_be(conn, conn->ctx, sess, NULL) < 0)
 			goto fail;
 		srv = objt_server(conn->target);