MEDIUM: config: deprecate the antique req* and rsp* commands

These commands don't follow the same flow as the rest of the commands,
each of them iterates over all header lines before switching to the
next directive. In addition they make no distinction between start
line and headers and can lead to unparsable rewrites which are very
difficult to deal with internally.

Most of them are still occasionally found in configurations, mainly
because of the usual "we've always done this way". By marking them
deprecated and emitting a warning and recommendation on first use of
each of them, we will raise users' awareness of users regarding the
cleaner, faster and more reliable alternatives.

Some use cases of "reqrep" still appear from time to time for URL
rewriting that is not so convenient with other rules. But at least
users facing this requirement will explain their use case so that we
can best serve them. Some discussion started on this subject in a
thread linked to from github issue #100.

The goal is to remove them in 2.1 since they require to reparse the
result before indexing it and we don't want this hack to live long.
The following directives were marked deprecated :

  -reqadd
  -reqallow
  -reqdel
  -reqdeny
  -reqiallow
  -reqidel
  -reqideny
  -reqipass
  -reqirep
  -reqitarpit
  -reqpass
  -reqrep
  -reqtarpit
  -rspadd
  -rspdel
  -rspdeny
  -rspidel
  -rspideny
  -rspirep
  -rsprep
diff --git a/doc/configuration.txt b/doc/configuration.txt
index cc3e31f..67ad2a5 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -2401,29 +2401,29 @@
 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 @@
   See also : "option redispatch"
 
 
-reqadd  <string> [{if | unless} <cond>]
+reqadd  <string> [{if | unless} <cond>] (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 @@
             and section 7 about ACLs.
 
 
-reqallow  <search> [{if | unless} <cond>]
-reqiallow <search> [{if | unless} <cond>] (ignore case)
+reqallow  <search> [{if | unless} <cond>] (deprecated)
+reqiallow <search> [{if | unless} <cond>] (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 @@
             manipulation, and section 7 about ACLs.
 
 
-reqdel  <search> [{if | unless} <cond>]
-reqidel <search> [{if | unless} <cond>]  (ignore case)
+reqdel  <search> [{if | unless} <cond>] (deprecated)
+reqidel <search> [{if | unless} <cond>] (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 @@
             HTTP header manipulation, and section 7 about ACLs.
 
 
-reqdeny  <search> [{if | unless} <cond>]
-reqideny <search> [{if | unless} <cond>]  (ignore case)
+reqdeny  <search> [{if | unless} <cond>] (deprecated)
+reqideny <search> [{if | unless} <cond>] (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 @@
             HTTP header manipulation, and section 7 about ACLs.
 
 
-reqpass  <search> [{if | unless} <cond>]
-reqipass <search> [{if | unless} <cond>]  (ignore case)
+reqpass  <search> [{if | unless} <cond>] (deprecated)
+reqipass <search> [{if | unless} <cond>] (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 @@
             HTTP header manipulation, and section 7 about ACLs.
 
 
-reqrep  <search> <string> [{if | unless} <cond>]
-reqirep <search> <string> [{if | unless} <cond>]   (ignore case)
+reqrep  <search> <string> [{if | unless} <cond>] (deprecated)
+reqirep <search> <string> [{if | unless} <cond>] (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 @@
             section 6 about HTTP header manipulation, and section 7 about ACLs.
 
 
-reqtarpit  <search> [{if | unless} <cond>]
-reqitarpit <search> [{if | unless} <cond>]  (ignore case)
+reqtarpit  <search> [{if | unless} <cond>] (deprecated)
+reqitarpit <search> [{if | unless} <cond>] (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 @@
 
   See also: "retries", "option redispatch", "tune.bufsize"
 
-rspadd <string> [{if | unless} <cond>]
+rspadd <string> [{if | unless} <cond>] (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 @@
             manipulation, and section 7 about ACLs.
 
 
-rspdel  <search> [{if | unless} <cond>]
-rspidel <search> [{if | unless} <cond>]  (ignore case)
+rspdel  <search> [{if | unless} <cond>] (deprecated)
+rspidel <search> [{if | unless} <cond>] (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 @@
             HTTP header manipulation, and section 7 about ACLs.
 
 
-rspdeny  <search> [{if | unless} <cond>]
-rspideny <search> [{if | unless} <cond>]  (ignore case)
+rspdeny  <search> [{if | unless} <cond>] (deprecated)
+rspideny <search> [{if | unless} <cond>] (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 @@
             HTTP header manipulation and section 7 about ACLs.
 
 
-rsprep  <search> <string> [{if | unless} <cond>]
-rspirep <search> <string> [{if | unless} <cond>]  (ignore case)
+rsprep  <search> <string> [{if | unless} <cond>] (deprecated)
+rspirep <search> <string> [{if | unless} <cond>] (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 a1d573b..2959da8 100644
--- a/include/types/global.h
+++ b/include/types/global.h
@@ -254,6 +254,18 @@
 #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 f96f154..7ffc0e0 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -3816,6 +3816,9 @@
 		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 <search> and <replace> as arguments.\n",
 				 file, linenum, args[0]);
@@ -3830,6 +3833,9 @@
 			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 @@
 			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 @@
 			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 @@
 			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 @@
 			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 @@
 			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 <search> and <replace> as arguments.\n",
 				 file, linenum, args[0]);
@@ -3879,6 +3900,9 @@
 			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 @@
 			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 @@
 			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 @@
 			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 @@
 			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 @@
 	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 @@
 		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 <search> and <replace> as arguments.\n",
 				 file, linenum, args[0]);
@@ -3969,6 +4011,9 @@
 			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 @@
 			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 @@
 			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 <search> and <replace> as arguments.\n",
 				 file, linenum, args[0]);
@@ -3997,6 +4048,9 @@
 			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 @@
 			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 @@
 	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;