From: Willy Tarreau Date: Tue, 26 May 2015 10:18:29 +0000 (+0200) Subject: MAJOR: config: remove the deprecated reqsetbe / reqisetbe actions X-Git-Tag: v1.6-dev2~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98d0485a908e9a682736575fe219c4cf02813b9b;p=thirdparty%2Fhaproxy.git MAJOR: config: remove the deprecated reqsetbe / reqisetbe actions These ones were already obsoleted in 1.4, marked for removal in 1.5, and not documented anymore. They used to emit warnings, and do still require quite some code to stay in place. Let's remove them now. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index a2eac7bb85..fdb0ddc651 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1608,12 +1608,10 @@ reqidel - X X X reqideny - X X X reqipass - X X X reqirep - X X X -reqisetbe - X X X reqitarpit - X X X reqpass - X X X reqrep - X X X -- keyword -------------------------- defaults - frontend - listen -- backend - -reqsetbe - X X X reqtarpit - X X X retries X - X X rspadd - X X X @@ -2655,7 +2653,7 @@ default_backend use_backend static if url_css url_img extension_img default_backend dynamic - See also : "use_backend", "reqsetbe", "reqisetbe" + See also : "use_backend" description diff --git a/include/common/regex.h b/include/common/regex.h index 76ed290644..30a5e3fc7f 100644 --- a/include/common/regex.h +++ b/include/common/regex.h @@ -60,7 +60,6 @@ struct my_regex { #define ACT_DENY 3 /* deny the request */ #define ACT_PASS 4 /* pass this header without allowing or denying the request */ #define ACT_TARPIT 5 /* tarpit the connection matching this request */ -#define ACT_SETBE 6 /* switch the backend */ struct hdr_exp { struct hdr_exp *next; diff --git a/include/types/global.h b/include/types/global.h index 7533bb0266..ec6679d7d0 100644 --- a/include/types/global.h +++ b/include/types/global.h @@ -192,7 +192,7 @@ extern unsigned int warned; /* bitfield of a few warnings to emit just once /* bit values to go with "warned" above */ #define WARN_BLOCK_DEPRECATED 0x00000001 -#define WARN_REQSETBE_DEPRECATED 0x00000002 +/* unassigned : 0x00000002 */ #define WARN_REDISPATCH_DEPRECATED 0x00000004 #define WARN_CLITO_DEPRECATED 0x00000008 #define WARN_SRVTO_DEPRECATED 0x00000010 diff --git a/src/cfgparse.c b/src/cfgparse.c index 1de7a1f3a0..cf3c0931b1 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -5645,26 +5645,6 @@ stats_error_parsing: if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[0], "reqsetbe")) { /* switch the backend from a regex, respecting case */ - err_code |= create_cond_regex_rule(file, linenum, curproxy, - SMP_OPT_DIR_REQ, ACT_SETBE, 0, - args[0], args[1], args[2], (const char **)args+3); - if (err_code & ERR_FATAL) - goto out; - - if (!already_warned(WARN_REQSETBE_DEPRECATED)) - Warning("parsing [%s:%d] : The '%s' directive is now deprecated in favor of the more efficient 'use_backend' which uses a different but more powerful syntax. Future versions will not support '%s' anymore, you should convert it now!\n", file, linenum, args[0], args[0]); - } - else if (!strcmp(args[0], "reqisetbe")) { /* switch the backend from a regex, ignoring case */ - err_code |= create_cond_regex_rule(file, linenum, curproxy, - SMP_OPT_DIR_REQ, ACT_SETBE, REG_ICASE, - args[0], args[1], args[2], (const char **)args+3); - if (err_code & ERR_FATAL) - goto out; - - if (!already_warned(WARN_REQSETBE_DEPRECATED)) - Warning("parsing [%s:%d] : The '%s' directive is now deprecated in favor of the more efficient 'use_backend' which uses a different but more powerful syntax. Future versions will not support '%s' anymore, you should convert it now!\n", file, linenum, args[0], args[0]); - } else if (!strcmp(args[0], "reqirep")) { /* replace request header from a regex, ignoring case */ if (*(args[2]) == 0) { Alert("parsing [%s:%d] : '%s' expects and as arguments.\n", @@ -6621,7 +6601,7 @@ next_line: * that it is always guaranteed that a backend pointed to by a frontend is * bound to all of its processes. After that, if the target is a "listen" * instance, the function recursively descends the target's own targets along - * default_backend, use_backend rules, and reqsetbe rules. Since the bits are + * default_backend and use_backend rules. Since the bits are * checked first to ensure that is already bound to all processes of * , there is no risk of looping and we ensure to follow the shortest * path to the destination. @@ -6635,7 +6615,6 @@ next_line: void propagate_processes(struct proxy *from, struct proxy *to) { struct switching_rule *rule; - struct hdr_exp *exp; if (to) { /* check whether we need to go down */ @@ -6670,14 +6649,6 @@ void propagate_processes(struct proxy *from, struct proxy *to) to = rule->be.backend; propagate_processes(from, to); } - - /* reqsetbe */ - for (exp = from->req_exp; exp != NULL; exp = exp->next) { - if (exp->action != ACT_SETBE) - continue; - to = (struct proxy *)exp->replace; - propagate_processes(from, to); - } } /* @@ -6973,39 +6944,6 @@ int check_config_validity() } } - /* find the target proxy in setbe */ - if (curproxy->mode == PR_MODE_HTTP && curproxy->req_exp != NULL) { - /* map jump target for ACT_SETBE in req_rep chain */ - struct hdr_exp *exp; - for (exp = curproxy->req_exp; exp != NULL; exp = exp->next) { - struct proxy *target; - - if (exp->action != ACT_SETBE) - continue; - - target = proxy_be_by_name(exp->replace); - if (!target) { - Alert("Proxy '%s': unable to find required setbe: '%s'.\n", - curproxy->id, exp->replace); - cfgerr++; - } else if (target == curproxy) { - Alert("Proxy '%s': loop detected for setbe: '%s'.\n", - curproxy->id, exp->replace); - cfgerr++; - } else if (target->mode != PR_MODE_HTTP) { - Alert("%s %s '%s' (%s:%d) tries to use incompatible %s %s '%s' (%s:%d) in a 'reqsetbe' rule (see 'mode').\n", - proxy_mode_str(curproxy->mode), proxy_type_str(curproxy), curproxy->id, - curproxy->conf.file, curproxy->conf.line, - proxy_mode_str(target->mode), proxy_type_str(target), target->id, - target->conf.file, target->conf.line); - cfgerr++; - } else { - free((void *)exp->replace); - exp->replace = (const char *)target; - } - } - } - /* find the target proxy for 'use_backend' rules */ list_for_each_entry(rule, &curproxy->switching_rules, list) { struct proxy *target; @@ -8112,7 +8050,6 @@ out_uri_auth_compat: */ for (fe = proxy; fe; fe = fe->next) { struct switching_rule *rule; - struct hdr_exp *exp; int found = 0; if (!(fe->cap & PR_CAP_FE)) @@ -8134,15 +8071,6 @@ out_uri_auth_compat: } } - /* check if a "reqsetbe" rule matches */ - for (exp = fe->req_exp; !found && exp; exp = exp->next) { - if (exp->action == ACT_SETBE && - (struct proxy *)exp->replace == curproxy) { - found = 1; - break; - } - } - /* now we've checked all possible ways to reference a backend * from a frontend. */ diff --git a/src/haproxy.c b/src/haproxy.c index 353ff8a7a9..1b77475810 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1220,8 +1220,7 @@ void deinit(void) free(exp->preg); } - if (exp->replace && exp->action != ACT_SETBE) - free((char *)exp->replace); + free((char *)exp->replace); expb = exp; exp = exp->next; free(expb); @@ -1233,8 +1232,7 @@ void deinit(void) free(exp->preg); } - if (exp->replace && exp->action != ACT_SETBE) - free((char *)exp->replace); + free((char *)exp->replace); expb = exp; exp = exp->next; free(expb); diff --git a/src/proto_http.c b/src/proto_http.c index 3d41c562b2..e19d4cdd02 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7127,19 +7127,6 @@ int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hd if (regex_exec_match2(exp->preg, cur_ptr, cur_end-cur_ptr, MAX_MATCH, pmatch, 0)) { switch (exp->action) { - case ACT_SETBE: - /* It is not possible to jump a second time. - * FIXME: should we return an HTTP/500 here so that - * the admin knows there's a problem ? - */ - if (s->be != strm_fe(s)) - break; - - /* Swithing Proxy */ - stream_set_backend(s, (struct proxy *)exp->replace); - last_hdr = 1; - break; - case ACT_ALLOW: txn->flags |= TX_CLALLOW; last_hdr = 1; @@ -7228,19 +7215,6 @@ int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_e if (regex_exec_match2(exp->preg, cur_ptr, cur_end-cur_ptr, MAX_MATCH, pmatch, 0)) { switch (exp->action) { - case ACT_SETBE: - /* It is not possible to jump a second time. - * FIXME: should we return an HTTP/500 here so that - * the admin knows there's a problem ? - */ - if (s->be != strm_fe(s)) - break; - - /* Swithing Proxy */ - stream_set_backend(s, (struct proxy *)exp->replace); - done = 1; - break; - case ACT_ALLOW: txn->flags |= TX_CLALLOW; done = 1;