[CLEANUP] Keep in sync "defaults" support between documentation and code

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
This commit is contained in:
Cyril Bont 2010-01-24 23:29:44 +01:00 committed by Willy Tarreau
parent 739cfbab6a
commit 99ed327d62
2 changed files with 27 additions and 3 deletions

View 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

View 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 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
}
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",