diff --git a/include/proto/acl.h b/include/proto/acl.h index 58591ab9d..1471dae42 100644 --- a/include/proto/acl.h +++ b/include/proto/acl.h @@ -84,8 +84,8 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int p /* 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 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 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 87e90ee90..5abf35e34 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -205,6 +205,7 @@ struct proxy { 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 @@ struct proxy { 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 2b3bbd547..58363fa16 100644 --- a/src/acl.c +++ b/src/acl.c @@ -1463,8 +1463,8 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int p /* 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 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 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 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, co 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 6b27c24d8..e277b12b4 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3040,8 +3040,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } /* 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 @@ int check_config_validity() 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 f259adedd..b0bab37e7 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -115,7 +115,7 @@ int frontend_accept(struct session *s) 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 25dda04b0..165fd724e 100644 --- a/src/log.c +++ b/src/log.c @@ -347,8 +347,7 @@ void add_sample_to_logformat_list(char *text, char *arg, int arg_len, struct pro /* 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 8f631f888..3cf0d81ad 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1129,8 +1129,7 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type, } /* 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 9ccd25ad8..1986a7c2b 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -828,7 +828,7 @@ int session_set_backend(struct session *s, struct proxy *be) /* 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 */