From: Willy Tarreau Date: Mon, 28 Apr 2014 20:56:38 +0000 (+0200) Subject: MEDIUM: config: warn that '{cli,con,srv}timeout' are deprecated X-Git-Tag: v1.5-dev25~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed44649eb78a8ce5efc203f273c7df774defe2af;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/types/global.h b/include/types/global.h index 82a8e9db52..241afe9bde 100644 --- a/include/types/global.h +++ b/include/types/global.h @@ -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) diff --git a/src/proxy.c b/src/proxy.c index ee7ffd7305..8e638c6fd5 100644 --- a/src/proxy.c +++ b/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;