[MINOR] cleanup set_session_backend by using pre-computed analysers

Analyser bitmaps are now stored in the frontend and backend, and
combined at configuration time. That way, set_session_backend()
does not need to perform any protocol-specific combinations.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 996ddc1..cddca1e 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -4139,6 +4139,29 @@
 			newsrv = newsrv->next;
 		}
 
+		if (curproxy->cap & PR_CAP_FE) {
+			if (curproxy->tcp_req.inspect_delay ||
+			    !LIST_ISEMPTY(&curproxy->tcp_req.inspect_rules))
+				curproxy->fe_req_ana |= AN_REQ_INSPECT;
+
+			if (curproxy->mode == PR_MODE_HTTP)
+				curproxy->fe_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_FE;
+
+			/* both TCP and HTTP must check switching rules */
+			curproxy->fe_req_ana |= AN_REQ_SWITCHING_RULES;
+		}
+
+		if (curproxy->cap & PR_CAP_BE) {
+			if (curproxy->mode == PR_MODE_HTTP)
+				curproxy->be_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_INNER | AN_REQ_HTTP_PROCESS_BE;
+
+			/* If the backend does requires RDP cookie persistence, we have to
+			 * enable the corresponding analyser.
+			 */
+			if (curproxy->options2 & PR_O2_RDPC_PRST)
+				curproxy->be_req_ana |= AN_REQ_PRST_RDP_COOKIE;
+		}
+
 		/* adjust this proxy's listeners */
 		listener = curproxy->listen;
 		while (listener) {
@@ -4150,11 +4173,7 @@
 			listener->accept = event_accept;
 			listener->private = curproxy;
 			listener->handler = process_session;
-			/* both TCP and HTTP must check switching rules */
-			listener->analysers |= AN_REQ_SWITCHING_RULES;
-
-			if (curproxy->mode == PR_MODE_HTTP)
-				listener->analysers |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_FE | AN_REQ_HTTP_INNER | AN_REQ_HTTP_PROCESS_BE;
+			listener->analysers |= curproxy->fe_req_ana;
 
 			/* smart accept mode is automatic in HTTP mode */
 			if ((curproxy->options2 & PR_O2_SMARTACC) ||
@@ -4162,10 +4181,6 @@
 			     !(curproxy->no_options2 & PR_O2_SMARTACC)))
 				listener->options |= LI_O_NOQUICKACK;
 
-			if (curproxy->tcp_req.inspect_delay ||
-			    !LIST_ISEMPTY(&curproxy->tcp_req.inspect_rules))
-				listener->analysers |= AN_REQ_INSPECT;
-
 			/* We want the use_backend and default_backend rules to apply */
 			listener = listener->next;
 		}
diff --git a/src/client.c b/src/client.c
index b2e7d78..c489168 100644
--- a/src/client.c
+++ b/src/client.c
@@ -401,6 +401,7 @@
 		/* activate default analysers enabled for this listener */
 		s->req->analysers = l->analysers;
 
+		/* note: this should not happen anymore since there's always at least the switching rules */
 		if (!s->req->analysers)
 			buffer_write_ena(s->req);  /* don't wait to establish connection */
 
diff --git a/src/proxy.c b/src/proxy.c
index 4e75b59..7dce8c8 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -667,21 +667,12 @@
 		hdr_idx_init(&s->txn.hdr_idx);
 	}
 
-	/* If we're switching from TCP mode to HTTP mode, we need to
-	 * enable several analysers on the backend.
-	 */
-	if (unlikely(s->fe->mode != PR_MODE_HTTP && s->be->mode == PR_MODE_HTTP)) {
-		/* We want to wait for a complete HTTP request and process the
-		 * backend parts.
-		 */
-		s->req->analysers |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_BE | AN_REQ_HTTP_INNER;
-	}
-
-	/* If the backend does requires RDP cookie persistence, we have to
-	 * enable the corresponding analyser.
+	/* We want to enable the backend-specific analysers except those which
+	 * were already run as part of the frontend/listener. Note that it would
+	 * be more reliable to store the list of analysers that have been run,
+	 * but what we do here is OK for now.
 	 */
-	if (s->be->options2 & PR_O2_RDPC_PRST)
-		s->req->analysers |= AN_REQ_PRST_RDP_COOKIE;
+	s->req->analysers |= be->be_req_ana & ~(s->listener->analysers);
 
 	return 1;
 }