diff --git a/doc/configuration.txt b/doc/configuration.txt index cc3e31ffb..67ad2a552 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -2401,29 +2401,29 @@ rate-limit sessions X X X - redirect - X X X redisp (deprecated) X - X X redispatch (deprecated) X - X X -reqadd - X X X -reqallow - X X X -reqdel - X X X -reqdeny - X X X -reqiallow - X X X -reqidel - X X X -reqideny - X X X -reqipass - X X X -reqirep - X X X -reqitarpit - X X X -reqpass - X X X -reqrep - X X X +reqadd (deprecated) - X X X +reqallow (deprecated) - X X X +reqdel (deprecated) - X X X +reqdeny (deprecated) - X X X +reqiallow (deprecated) - X X X +reqidel (deprecated) - X X X +reqideny (deprecated) - X X X +reqipass (deprecated) - X X X +reqirep (deprecated) - X X X +reqitarpit (deprecated) - X X X +reqpass (deprecated) - X X X +reqrep (deprecated) - X X X -- keyword -------------------------- defaults - frontend - listen -- backend - -reqtarpit - X X X +reqtarpit (deprecated) - X X X retries X - X X retry-on X - X X -rspadd - X X X -rspdel - X X X -rspdeny - X X X -rspidel - X X X -rspideny - X X X -rspirep - X X X -rsprep - X X X +rspadd (deprecated) - X X X +rspdel (deprecated) - X X X +rspdeny (deprecated) - X X X +rspidel (deprecated) - X X X +rspideny (deprecated) - X X X +rspirep (deprecated) - X X X +rsprep (deprecated) - X X X server - - X X server-state-file-name X - X X server-template - - X X @@ -7734,7 +7734,7 @@ redispatch (deprecated) See also : "option redispatch" -reqadd [{if | unless} ] +reqadd [{if | unless} ] (deprecated) Add a header at the end of the HTTP request May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7761,8 +7761,8 @@ reqadd [{if | unless} ] and section 7 about ACLs. -reqallow [{if | unless} ] -reqiallow [{if | unless} ] (ignore case) +reqallow [{if | unless} ] (deprecated) +reqiallow [{if | unless} ] (ignore case) (deprecated) Definitely allow an HTTP request if a line matches a regular expression May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7796,8 +7796,8 @@ reqiallow [{if | unless} ] (ignore case) manipulation, and section 7 about ACLs. -reqdel [{if | unless} ] -reqidel [{if | unless} ] (ignore case) +reqdel [{if | unless} ] (deprecated) +reqidel [{if | unless} ] (ignore case) (deprecated) Delete all headers matching a regular expression in an HTTP request May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7830,8 +7830,8 @@ reqidel [{if | unless} ] (ignore case) HTTP header manipulation, and section 7 about ACLs. -reqdeny [{if | unless} ] -reqideny [{if | unless} ] (ignore case) +reqdeny [{if | unless} ] (deprecated) +reqideny [{if | unless} ] (ignore case) (deprecated) Deny an HTTP request if a line matches a regular expression May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7869,8 +7869,8 @@ reqideny [{if | unless} ] (ignore case) HTTP header manipulation, and section 7 about ACLs. -reqpass [{if | unless} ] -reqipass [{if | unless} ] (ignore case) +reqpass [{if | unless} ] (deprecated) +reqipass [{if | unless} ] (ignore case) (deprecated) Ignore any HTTP request line matching a regular expression in next rules May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7904,8 +7904,8 @@ reqipass [{if | unless} ] (ignore case) HTTP header manipulation, and section 7 about ACLs. -reqrep [{if | unless} ] -reqirep [{if | unless} ] (ignore case) +reqrep [{if | unless} ] (deprecated) +reqirep [{if | unless} ] (ignore case) (deprecated) Replace a regular expression with a string in an HTTP request line May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -7946,8 +7946,8 @@ reqirep [{if | unless} ] (ignore case) section 6 about HTTP header manipulation, and section 7 about ACLs. -reqtarpit [{if | unless} ] -reqitarpit [{if | unless} ] (ignore case) +reqtarpit [{if | unless} ] (deprecated) +reqitarpit [{if | unless} ] (ignore case) (deprecated) Tarpit an HTTP request containing a line matching a regular expression May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -8096,7 +8096,7 @@ retry-on [list of keywords] See also: "retries", "option redispatch", "tune.bufsize" -rspadd [{if | unless} ] +rspadd [{if | unless} ] (deprecated) Add a header at the end of the HTTP response May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -8119,8 +8119,8 @@ rspadd [{if | unless} ] manipulation, and section 7 about ACLs. -rspdel [{if | unless} ] -rspidel [{if | unless} ] (ignore case) +rspdel [{if | unless} ] (deprecated) +rspidel [{if | unless} ] (ignore case) (deprecated) Delete all headers matching a regular expression in an HTTP response May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -8153,8 +8153,8 @@ rspidel [{if | unless} ] (ignore case) HTTP header manipulation, and section 7 about ACLs. -rspdeny [{if | unless} ] -rspideny [{if | unless} ] (ignore case) +rspdeny [{if | unless} ] (deprecated) +rspideny [{if | unless} ] (ignore case) (deprecated) Block an HTTP response if a line matches a regular expression May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes @@ -8191,8 +8191,8 @@ rspideny [{if | unless} ] (ignore case) HTTP header manipulation and section 7 about ACLs. -rsprep [{if | unless} ] -rspirep [{if | unless} ] (ignore case) +rsprep [{if | unless} ] (deprecated) +rspirep [{if | unless} ] (ignore case) (deprecated) Replace a regular expression with a string in an HTTP response line May be used in sections : defaults | frontend | listen | backend no | yes | yes | yes diff --git a/include/types/global.h b/include/types/global.h index a1d573bf8..2959da8dd 100644 --- a/include/types/global.h +++ b/include/types/global.h @@ -254,6 +254,18 @@ extern int atexit_flag; #define WARN_CONTO_DEPRECATED 0x00000020 #define WARN_FORCECLOSE_DEPRECATED 0x00000040 +#define WARN_REQREP_DEPRECATED 0x00000080 +#define WARN_REQDEL_DEPRECATED 0x00000100 +#define WARN_REQDENY_DEPRECATED 0x00000200 +#define WARN_REQPASS_DEPRECATED 0x00000400 +#define WARN_REQALLOW_DEPRECATED 0x00000800 +#define WARN_REQTARPIT_DEPRECATED 0x00001000 +#define WARN_REQADD_DEPRECATED 0x00002000 +#define WARN_RSPREP_DEPRECATED 0x00004000 +#define WARN_RSPDEL_DEPRECATED 0x00008000 +#define WARN_RSPDENY_DEPRECATED 0x00010000 +#define WARN_RSPADD_DEPRECATED 0x00020000 + /* to be used with warned and WARN_* */ static inline int already_warned(unsigned int warning) { diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index f96f1541c..7ffc0e094 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -3816,6 +3816,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "cliexp") || !strcmp(args[0], "reqrep")) { /* replace request header from a regex */ + if (!already_warned(WARN_REQREP_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request replace-header' and will be removed in next version.\n", file, linenum, args[0]); + if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects and as arguments.\n", file, linenum, args[0]); @@ -3830,6 +3833,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqdel")) { /* delete request header from a regex */ + if (!already_warned(WARN_REQDEL_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request del-header' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_REMOVE, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3837,6 +3843,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqdeny")) { /* deny a request if a header matches this regex */ + if (!already_warned(WARN_REQDENY_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request deny' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_DENY, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3844,6 +3853,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqpass")) { /* pass this header without allowing or denying the request */ + if (!already_warned(WARN_REQPASS_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_PASS, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3851,6 +3863,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqallow")) { /* allow a request if a header matches this regex */ + if (!already_warned(WARN_REQALLOW_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request allow' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_ALLOW, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3858,6 +3873,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqtarpit")) { /* tarpit a request if a header matches this regex */ + if (!already_warned(WARN_REQTARPIT_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request tarpit' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_TARPIT, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3865,6 +3883,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqirep")) { /* replace request header from a regex, ignoring case */ + if (!already_warned(WARN_REQREP_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request replace-header' and will be removed in next version.\n", file, linenum, args[0]); + if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects and as arguments.\n", file, linenum, args[0]); @@ -3879,6 +3900,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqidel")) { /* delete request header from a regex ignoring case */ + if (!already_warned(WARN_REQDEL_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request del-header' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_REMOVE, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -3886,6 +3910,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqideny")) { /* deny a request if a header matches this regex ignoring case */ + if (!already_warned(WARN_REQDENY_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request deny' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_DENY, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -3893,6 +3920,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqipass")) { /* pass this header without allowing or denying the request */ + if (!already_warned(WARN_REQPASS_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_PASS, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -3900,6 +3930,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqiallow")) { /* allow a request if a header matches this regex ignoring case */ + if (!already_warned(WARN_REQALLOW_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request allow' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_ALLOW, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -3907,6 +3940,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "reqitarpit")) { /* tarpit a request if a header matches this regex ignoring case */ + if (!already_warned(WARN_REQTARPIT_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request tarpit' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_REQ, ACT_TARPIT, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -3916,6 +3952,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) else if (!strcmp(args[0], "reqadd")) { /* add request header */ struct cond_wordlist *wl; + if (!already_warned(WARN_REQADD_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-request add-header' and will be removed in next version.\n", file, linenum, args[0]); + if (curproxy == &defproxy) { ha_alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -3955,6 +3994,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) warnif_misplaced_reqadd(curproxy, file, linenum, args[0]); } else if (!strcmp(args[0], "srvexp") || !strcmp(args[0], "rsprep")) { /* replace response header from a regex */ + if (!already_warned(WARN_RSPREP_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response replace-header' and will be removed in next version.\n", file, linenum, args[0]); + if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects and as arguments.\n", file, linenum, args[0]); @@ -3969,6 +4011,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "rspdel")) { /* delete response header from a regex */ + if (!already_warned(WARN_RSPDEL_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response del-header' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_RES, ACT_REMOVE, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3976,6 +4021,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "rspdeny")) { /* block response header from a regex */ + if (!already_warned(WARN_RSPDENY_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response deny' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_RES, ACT_DENY, 0, args[0], args[1], NULL, (const char **)args+2); @@ -3983,6 +4031,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "rspirep")) { /* replace response header from a regex ignoring case */ + if (!already_warned(WARN_RSPREP_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response replace-header' and will be removed in next version.\n", file, linenum, args[0]); + if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects and as arguments.\n", file, linenum, args[0]); @@ -3997,6 +4048,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "rspidel")) { /* delete response header from a regex ignoring case */ + if (!already_warned(WARN_RSPDEL_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response del-header' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_RES, ACT_REMOVE, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -4004,6 +4058,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } else if (!strcmp(args[0], "rspideny")) { /* block response header from a regex ignoring case */ + if (!already_warned(WARN_RSPDENY_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response deny' and will be removed in next version.\n", file, linenum, args[0]); + err_code |= create_cond_regex_rule(file, linenum, curproxy, SMP_OPT_DIR_RES, ACT_DENY, REG_ICASE, args[0], args[1], NULL, (const char **)args+2); @@ -4013,6 +4070,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) else if (!strcmp(args[0], "rspadd")) { /* add response header */ struct cond_wordlist *wl; + if (!already_warned(WARN_RSPADD_DEPRECATED)) + ha_warning("parsing [%s:%d] : The '%s' directive is deprecated in favor of 'http-response add-header' and will be removed in next version.\n", file, linenum, args[0]); + if (curproxy == &defproxy) { ha_alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL;