/* 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);
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 */
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 */
/* 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.
cond->file = file;
cond->line = line;
- px->acl_requires |= cond->requires;
-
+ px->http_needed |= !!(cond->requires & ACL_USE_L7_ANY);
return cond;
}
}
/* 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++;
break;
case PR_MODE_HTTP:
- curproxy->acl_requires |= ACL_USE_L7_ANY;
+ curproxy->http_needed = 1;
break;
}
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).
/* 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
}
/* 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++;
/* 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 */