mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-21 13:16:57 +00:00
MEDIUM: config: warn that '{cli,con,srv}timeout' are deprecated
It's been like this since version 1.3 in 2007. It's time to clean up configurations. The warning explains what to use depending on the timeout name.
This commit is contained in:
parent
a3c504c032
commit
ed44649eb7
@ -176,6 +176,9 @@ extern unsigned int warned; /* bitfield of a few warnings to emit just once
|
||||
#define WARN_BLOCK_DEPRECATED 0x00000001
|
||||
#define WARN_REQSETBE_DEPRECATED 0x00000002
|
||||
#define WARN_REDISPATCH_DEPRECATED 0x00000004
|
||||
#define WARN_CLITO_DEPRECATED 0x00000008
|
||||
#define WARN_SRVTO_DEPRECATED 0x00000010
|
||||
#define WARN_CONTO_DEPRECATED 0x00000020
|
||||
|
||||
/* to be used with warned and WARN_* */
|
||||
static inline int already_warned(unsigned int warning)
|
||||
|
14
src/proxy.c
14
src/proxy.c
@ -139,6 +139,7 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
|
||||
const char *res, *name;
|
||||
int *tv = NULL;
|
||||
int *td = NULL;
|
||||
int warn = 0;
|
||||
|
||||
retval = 0;
|
||||
|
||||
@ -147,7 +148,7 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
|
||||
args++;
|
||||
|
||||
name = args[0];
|
||||
if (!strcmp(args[0], "client") || !strcmp(args[0], "clitimeout")) {
|
||||
if (!strcmp(args[0], "client") || (!strcmp(args[0], "clitimeout") && (warn = WARN_CLITO_DEPRECATED))) {
|
||||
name = "client";
|
||||
tv = &proxy->timeout.client;
|
||||
td = &defpx->timeout.client;
|
||||
@ -164,12 +165,12 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
|
||||
tv = &proxy->timeout.httpreq;
|
||||
td = &defpx->timeout.httpreq;
|
||||
cap = PR_CAP_FE | PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "server") || !strcmp(args[0], "srvtimeout")) {
|
||||
} else if (!strcmp(args[0], "server") || (!strcmp(args[0], "srvtimeout") && (warn = WARN_SRVTO_DEPRECATED))) {
|
||||
name = "server";
|
||||
tv = &proxy->timeout.server;
|
||||
td = &defpx->timeout.server;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "connect") || !strcmp(args[0], "contimeout")) {
|
||||
} else if (!strcmp(args[0], "connect") || (!strcmp(args[0], "contimeout") && (warn = WARN_CONTO_DEPRECATED))) {
|
||||
name = "connect";
|
||||
tv = &proxy->timeout.connect;
|
||||
td = &defpx->timeout.connect;
|
||||
@ -215,6 +216,13 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
|
||||
memprintf(err, "overwriting 'timeout %s' which was already specified", name);
|
||||
retval = 1;
|
||||
}
|
||||
else if (warn) {
|
||||
if (!already_warned(warn)) {
|
||||
memprintf(err, "the '%s' directive is now deprecated in favor of 'timeout %s', and will not be supported in future versions.",
|
||||
args[0], name);
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
*tv = MS_TO_TICKS(timeout);
|
||||
return retval;
|
||||
|
Loading…
Reference in New Issue
Block a user