]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[CLEANUP] Keep in sync "defaults" support between documentation and code
authorCyril Bonté <cyril.bonte@free.fr>
Sun, 24 Jan 2010 22:29:44 +0000 (23:29 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Jan 2010 22:20:35 +0000 (23:20 +0100)
Hi Willy,

I've made a quick pass on the "defaults" column in the Proxy keywords matrix (chapter 4.1. in the documentation).
This patch resyncs the code and the documentation. I let you decide if some keywords that still work in the "defaults" section should be forbidden.

- default_backend : in the matrix, "defaults" was not supported but the keyword details say it is.
Tests also shows it works, then I've updated the matrix.

- capture cookie : in the keyword details, we can read `It is not possible to specify a capture in a "defaults" section.'.
Ok, even if the tests worked, I've added an alert in the configuration parser (as it is for capture request/response header).

- description : not supported in "defaults", I added an alert in the parser.
I've also noticed that this keyword doesn't appear in the documentation.
There's one "description" entry, but for the "global" section, which is for a different use (the patch doesn't update the documentation).

- grace : even if this is maybe useless, it works in "defaults". Documentation is updated.
- redirect : alert is added in the parser.
- rsprep : alert added in the parser.

--
Cyril Bonté

doc/configuration.txt
src/cfgparse.c

index a591a21f9cbd3129123bb9f9b449026063cfae4f..a1383ad77daa2bbd79a4676508a86aee11705c3b 100644 (file)
@@ -752,7 +752,7 @@ clitimeout                  X          X         X         -  (deprecated)
 contimeout                  X          -         X         X  (deprecated)
 cookie                      X          -         X         X
 default-server              X          -         X         X
-default_backend             -          X         X         -
+default_backend             X          X         X         -
 description                 -          X         X         X
 disabled                    X          X         X         X
 dispatch                    -          -         X         X
@@ -762,7 +762,7 @@ errorloc                    X          X         X         X
 errorloc302                 X          X         X         X
 errorloc303                 X          X         X         X
 fullconn                    X          -         X         X
-grace                       -          X         X         X
+grace                       X          X         X         X
 hash-type                   X          -         X         X
 http-check disable-on-404   X          -         X         X
 id                          -          X         X         X
@@ -1867,7 +1867,7 @@ fullconn <conns>
 grace <time>
   Maintain a proxy operational for some time after a soft stop
   May be used in sections :   defaults | frontend | listen | backend
-                                  no   |    yes   |   yes  |   yes
+                                 yes   |    yes   |   yes  |   yes
   Arguments :
     <time>    is the time (by default in milliseconds) for which the instance
               will remain operational with the frontend sockets still listening
index 109c0583dfbf7948693b8029b193ba02647ed0a9..242ef82831b2f1e231880c67902ad004c64cbdb6 100644 (file)
@@ -1409,6 +1409,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                int i, len=0;
                char *d;
 
+               if (curproxy == &defproxy) {
+                       Alert("parsing [%s:%d]: '%s' not allowed in 'defaults' section.\n",
+                                file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+
                if (!*args[1]) {
                        Alert("parsing [%s:%d]: '%s' expects a string argument.\n",
                                file, linenum, args[0]);
@@ -1711,6 +1718,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        err_code |= ERR_WARN;
 
                if (!strcmp(args[1], "cookie")) {  /* name of a cookie to capture */
+                       if (curproxy == &defproxy) {
+                               Alert("parsing [%s:%d] : '%s %s' not allowed in 'defaults' section.\n", file, linenum, args[0], args[1]);
+                               err_code |= ERR_ALERT | ERR_FATAL;
+                               goto out;
+                       }
+
                        if (*(args[4]) == 0) {
                                Alert("parsing [%s:%d] : '%s' expects 'cookie' <cookie_name> 'len' <len>.\n",
                                      file, linenum, args[0]);
@@ -1845,6 +1858,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                int cookie_set = 0;
                unsigned int flags = REDIRECT_FLAG_NONE;
 
+               if (curproxy == &defproxy) {
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+
                cur_arg = 1;
                while (*(args[cur_arg])) {
                        if (!strcmp(args[cur_arg], "location")) {
@@ -3979,6 +3998,11 @@ stats_error_parsing:
        }
        else if (!strcmp(args[0], "srvexp") || !strcmp(args[0], "rsprep")) {  /* replace response header from a regex */
                regex_t *preg;
+               if (curproxy == &defproxy) {
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
        
                if (*(args[1]) == 0 || *(args[2]) == 0) {
                        Alert("parsing [%s:%d] : '%s' expects <search> and <replace> as arguments.\n",