MEDIUM: proxy: remove acl_requires and just keep a flag "http_needed"

Proxy's acl_requires was a copy of all bits taken from ACLs, but we'll
get rid of ACL flags and only rely on sample fetches soon. The proxy's
acl_requires was only used to allocate an HTTP context when needed, and
was even forced in HTTP mode. So better have a flag which exactly says
what it's supposed to be used for.
diff --git a/include/proto/acl.h b/include/proto/acl.h
index 58591ab..1471dae 100644
--- a/include/proto/acl.h
+++ b/include/proto/acl.h
@@ -84,8 +84,8 @@
 /* Builds an ACL condition starting at the if/unless keyword. The complete
  * condition is returned. NULL is returned in case of error or if the first
  * word is neither "if" nor "unless". It automatically sets the file name and
- * the line number in the condition for better error reporting, and adds the
- * ACL requirements to the proxy's acl_requires. If <err> is not NULL, it will
+ * the line number in the condition for better error reporting, and sets the
+ * HTTP initialization requirements in the proxy. If <err> is not NULL, it will
  * be set to an error message upon errors, that the caller will have to free.
  */
 struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, const char **args, char **err);
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 87e90ee..5abf35e 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -205,6 +205,7 @@
 	unsigned int fe_req_ana, be_req_ana;	/* bitmap of common request protocol analysers for the frontend and backend */
 	unsigned int fe_rsp_ana, be_rsp_ana;	/* bitmap of common response protocol analysers for the frontend and backend */
 	int mode;				/* mode = PR_MODE_TCP, PR_MODE_HTTP or PR_MODE_HEALTH */
+	unsigned int http_needed;               /* non-null if HTTP analyser may be used */
 	union {
 		struct proxy *be;		/* default backend, or NULL if none set */
 		char *name;			/* default backend name during config parse */
@@ -227,7 +228,6 @@
 		unsigned int inspect_delay;     /* inspection delay */
 		struct list inspect_rules;      /* inspection rules */
 	} tcp_rep;
-	int acl_requires;                       /* Elements required to satisfy all ACLs (ACL_USE_*) */
 	struct server *srv, defsrv;		/* known servers; default server configuration */
 	int srv_act, srv_bck;			/* # of servers eligible for LB (UP|!checked) AND (enabled+weight!=0) */
 	struct lbprm lbprm;			/* load-balancing parameters */
diff --git a/src/acl.c b/src/acl.c
index 2b3bbd5..58363fa 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1463,8 +1463,8 @@
 /* Builds an ACL condition starting at the if/unless keyword. The complete
  * condition is returned. NULL is returned in case of error or if the first
  * word is neither "if" nor "unless". It automatically sets the file name and
- * the line number in the condition for better error reporting, and adds the
- * ACL requirements to the proxy's acl_requires. If <err> is not NULL, it will
+ * the line number in the condition for better error reporting, and sets the
+ * HTTP intiailization requirements in the proxy. If <err> is not NULL, it will
  * be filled with a pointer to an error message in case of error, that the
  * caller is responsible for freeing. The initial location must either be
  * freeable or NULL.
@@ -1498,8 +1498,7 @@
 
 	cond->file = file;
 	cond->line = line;
-	px->acl_requires |= cond->requires;
-
+	px->http_needed |= !!(cond->requires & ACL_USE_L7_ANY);
 	return cond;
 }
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 6b27c24..e277b12 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -3040,8 +3040,7 @@
 		}
 
 		/* check if we need to allocate an hdr_idx struct for HTTP parsing */
-		if (expr->fetch->use & SMP_USE_HTTP_ANY)
-			curproxy->acl_requires |= ACL_USE_L7_ANY;
+		curproxy->http_needed |= !!(expr->fetch->use & SMP_USE_HTTP_ANY);
 
 		if (strcmp(args[myidx], "table") == 0) {
 			myidx++;
@@ -6044,7 +6043,7 @@
 			break;
 
 		case PR_MODE_HTTP:
-			curproxy->acl_requires |= ACL_USE_L7_ANY;
+			curproxy->http_needed = 1;
 			break;
 		}
 
diff --git a/src/frontend.c b/src/frontend.c
index f259ade..b0bab37 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -115,7 +115,7 @@
 			goto out_free_reqcap;	/* no memory */
 	}
 
-	if (s->fe->acl_requires & ACL_USE_L7_ANY) {
+	if (s->fe->http_needed) {
 		/* we have to allocate header indexes only if we know
 		 * that we may make use of them. This of course includes
 		 * (mode == PR_MODE_HTTP).
diff --git a/src/log.c b/src/log.c
index 25dda04..165fd72 100644
--- a/src/log.c
+++ b/src/log.c
@@ -347,8 +347,7 @@
 
 	/* check if we need to allocate an hdr_idx struct for HTTP parsing */
 	/* Note, we may also need to set curpx->to_log with certain fetches */
-	if (expr->fetch->use & SMP_USE_HTTP_ANY)
-		curpx->acl_requires |= ACL_USE_L7_ANY;
+	curpx->http_needed |= !!(expr->fetch->use & SMP_USE_HTTP_ANY);
 
 	/* FIXME: temporary workaround for missing LW_XPRT flag needed with some
 	 * sample fetches (eg: ssl*). We always set it for now on, but this will
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 8f631f8..3cf0d81 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1129,8 +1129,7 @@
 		}
 
 		/* check if we need to allocate an hdr_idx struct for HTTP parsing */
-		if (expr->fetch->use & SMP_USE_HTTP_ANY)
-			curpx->acl_requires |= ACL_USE_L7_ANY;
+		curpx->http_needed |= !!(expr->fetch->use & SMP_USE_HTTP_ANY);
 
 		if (strcmp(args[arg], "table") == 0) {
 			arg++;
diff --git a/src/proxy.c b/src/proxy.c
index 9ccd25a..1986a7c 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -828,7 +828,7 @@
 	/* If the target backend requires HTTP processing, we have to allocate
 	 * a struct hdr_idx for it if we did not have one.
 	 */
-	if (unlikely(!s->txn.hdr_idx.v && (be->acl_requires & ACL_USE_L7_ANY))) {
+	if (unlikely(!s->txn.hdr_idx.v && be->http_needed)) {
 		if ((s->txn.hdr_idx.v = pool_alloc2(pool2_hdr_idx)) == NULL)
 			return 0; /* not enough memory */