MINOR: backend: handle reuse for conns with no server as target

If dispatch mode or transparent backend is used, the backend connection
target is a proxy instead of a server. In these cases, the reuse of
backend connections is not consistent.

With the default behavior, no reuse is done and every new request uses a
new connection. However, if http-reuse is set to never, the connection
are stored by the mux in the session and can be reused for future
requests in the same session.

As no server is used for these connections, no reuse can be made outside
of the session, similarly to http-reuse never mode. A different
http-reuse config value should not have an impact. To achieve this, mark
these connections as private to have a defined behavior.

For this feature to properly work, the connection hash has been slightly
adjusted. The server pointer as an input as been replaced by a generic
target pointer to refer to the server or proxy instance. The hash is
always calculated on connect_server even if the connection target is not
a server. This also requires to allocate the connection hash node for
every backend connections, not just the one with a server target.
diff --git a/src/backend.c b/src/backend.c
index 6d0fb86..4c1839d 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1277,14 +1277,18 @@
 	int64_t hash = 0;
 	struct conn_hash_params hash_params;
 
+	/* in standard configuration, srv will be valid
+	 * it can be NULL for dispatch mode or transparent backend */
+	srv = objt_server(s->target);
+
 	/* first, set unique connection parameters and then calculate hash */
 	memset(&hash_params, 0, sizeof(hash_params));
 
-	srv = objt_server(s->target);
-	hash_params.srv = srv;
+	/* 1. target */
+	hash_params.target = s->target;
 
 #ifdef USE_OPENSSL
-	/* 1. sni */
+	/* 2. sni */
 	if (srv && srv->ssl_ctx.sni) {
 		sni_smp = sample_fetch_as_type(s->be, s->sess, s,
 		                               SMP_OPT_DIR_REQ | SMP_OPT_FINAL,
@@ -1302,7 +1306,7 @@
 	}
 #endif /* USE_OPENSSL */
 
-	/* 2. destination address */
+	/* 3. destination address */
 	if (!(s->flags & SF_ADDR_SET)) {
 		err = alloc_dst_address(&s->target_addr, srv, s);
 		if (err != SRV_STATUS_OK)
@@ -1314,14 +1318,14 @@
 	if (srv && (!is_addr(&srv->addr) || srv->flags & SRV_F_MAPPORTS))
 		hash_params.dst_addr = s->target_addr;
 
-	/* 3. source address */
+	/* 4. source address */
 	err = alloc_bind_address(&bind_addr, srv, s);
 	if (err != SRV_STATUS_OK)
 		return SF_ERR_INTERNAL;
 
 	hash_params.src_addr = bind_addr;
 
-	/* 4. proxy protocol */
+	/* 5. proxy protocol */
 	if (srv && srv->pp_opts) {
 		proxy_line_ret = make_proxy_line(trash.area, trash.size, srv, cli_conn, s);
 		if (proxy_line_ret) {
@@ -1330,8 +1334,7 @@
 		}
 	}
 
-	if (srv)
-		hash = conn_calculate_hash(&hash_params);
+	hash = conn_calculate_hash(&hash_params);
 
 	/* This will catch some corner cases such as lying connections resulting from
 	 * retries or connect timeouts but will rarely trigger.
@@ -1503,7 +1506,11 @@
 
 		if (srv_conn) {
 			srv_conn->owner = s->sess;
-			if (reuse_mode == PR_O_REUSE_NEVR)
+
+			/* connection will be attached to the session if
+			 * http-reuse mode is never or it is not targeted to a
+			 * server */
+			if (reuse_mode == PR_O_REUSE_NEVR || !srv)
 				conn_set_private(srv_conn);
 
 			/* assign bind_addr to srv_conn */
@@ -1729,8 +1736,7 @@
 		}
 	}
 
-	if (srv)
-		srv_conn->hash_node->hash = hash;
+	srv_conn->hash_node->hash = hash;
 
 	return SF_ERR_NONE;  /* connection is OK */
 }
diff --git a/src/connection.c b/src/connection.c
index a9edf01..535fb6b 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1465,7 +1465,7 @@
 
 	buf = trash.area;
 
-	conn_hash_update(buf, &idx, &params->srv, sizeof(params->srv), &hash_flags, 0);
+	conn_hash_update(buf, &idx, &params->target, sizeof(params->target), &hash_flags, 0);
 
 	if (params->sni_prehash) {
 		conn_hash_update(buf, &idx,