]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: warn that '{cli,con,srv}timeout' are deprecated
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2014 20:56:38 +0000 (22:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2014 23:09:56 +0000 (01:09 +0200)
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.

include/types/global.h
src/proxy.c

index 82a8e9db520f46c24bf15f40243d3ece31f9ee09..241afe9bde2f9ec5bbfea0d2914743a4acd36abb 100644 (file)
@@ -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)
index ee7ffd730558c8bc57f19f2f2f3016733b46b1e1..8e638c6fd54e28253f9d6ebfb66b4656afc14000 100644 (file)
@@ -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;