From: Christopher Faulet Date: Wed, 17 Jul 2019 13:19:51 +0000 (+0200) Subject: MINOR: proxy: Remove the unused list of block rules X-Git-Tag: v2.1-dev2~340 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c3b63ae1d208d0fc8118f31feacf0f5ee1b075e;p=thirdparty%2Fhaproxy.git MINOR: proxy: Remove the unused list of block rules The keyword "block" is now unsupported. So the list of block rules is now unused. It can be safely removed from the structure proxy. --- diff --git a/include/types/proxy.h b/include/types/proxy.h index 86788a1e6e..a57b0739db 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -312,7 +312,6 @@ struct proxy { struct list acl; /* ACL declared on this proxy */ struct list http_req_rules; /* HTTP request rules: allow/deny/... */ struct list http_res_rules; /* HTTP response rules: allow/deny/... */ - struct list block_rules; /* http-request block rules to be inserted before other ones */ struct list redirect_rules; /* content redirecting rules (chained) */ struct list switching_rules; /* content switching rules (chained) */ struct list persist_rules; /* 'force-persist' and 'ignore-persist' rules (chained) */ diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index bb0764d113..f324a636f2 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -66,19 +66,6 @@ int warnif_rule_after_monitor(struct proxy *proxy, const char *file, int line, c return 0; } -/* Report a warning if a rule is placed after a 'block' rule. - * Return 1 if the warning has been emitted, otherwise 0. - */ -int warnif_rule_after_block(struct proxy *proxy, const char *file, int line, const char *arg) -{ - if (!LIST_ISEMPTY(&proxy->block_rules)) { - ha_warning("parsing [%s:%d] : a '%s' rule placed after a 'block' rule will still be processed before.\n", - file, line, arg); - return 1; - } - return 0; -} - /* Report a warning if a rule is placed after an 'http_request' rule. * Return 1 if the warning has been emitted, otherwise 0. */ @@ -186,19 +173,12 @@ int warnif_misplaced_http_req(struct proxy *proxy, const char *file, int line, c } /* report a warning if a block rule is dangerously placed */ -int warnif_misplaced_block(struct proxy *proxy, const char *file, int line, const char *arg) +int warnif_misplaced_monitor(struct proxy *proxy, const char *file, int line, const char *arg) { return warnif_rule_after_http_req(proxy, file, line, arg) || warnif_misplaced_http_req(proxy, file, line, arg); } -/* report a warning if a block rule is dangerously placed */ -int warnif_misplaced_monitor(struct proxy *proxy, const char *file, int line, const char *arg) -{ - return warnif_rule_after_block(proxy, file, line, arg) || - warnif_misplaced_block(proxy, file, line, arg); -} - /* report a warning if a "tcp request content" rule is dangerously placed */ int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg) { diff --git a/src/cfgparse.c b/src/cfgparse.c index a58c33d3cf..ecf62f997c 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2813,16 +2813,6 @@ int check_config_validity() } } - /* move any "block" rules at the beginning of the http-request rules */ - if (!LIST_ISEMPTY(&curproxy->block_rules)) { - /* insert block_rules into http_req_rules at the beginning */ - curproxy->block_rules.p->n = curproxy->http_req_rules.n; - curproxy->http_req_rules.n->p = curproxy->block_rules.p; - curproxy->block_rules.n->p = &curproxy->http_req_rules; - curproxy->http_req_rules.n = curproxy->block_rules.n; - LIST_INIT(&curproxy->block_rules); - } - if (curproxy->table && curproxy->table->peers.name) { struct peers *curpeers; @@ -3374,12 +3364,6 @@ out_uri_auth_compat: err_code |= ERR_WARN; } - if (!LIST_ISEMPTY(&curproxy->block_rules)) { - ha_warning("config : 'block' rules ignored for %s '%s' as they require HTTP mode.\n", - proxy_type_str(curproxy), curproxy->id); - err_code |= ERR_WARN; - } - if (!LIST_ISEMPTY(&curproxy->redirect_rules)) { ha_warning("config : 'redirect' rules ignored for %s '%s' as they require HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); diff --git a/src/proxy.c b/src/proxy.c index de54f0b806..eba6ec765b 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -862,7 +862,6 @@ void init_new_proxy(struct proxy *p) LIST_INIT(&p->acl); LIST_INIT(&p->http_req_rules); LIST_INIT(&p->http_res_rules); - LIST_INIT(&p->block_rules); LIST_INIT(&p->redirect_rules); LIST_INIT(&p->mon_fail_cond); LIST_INIT(&p->switching_rules);