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 82a8e9d..241afe9 100644
--- a/include/types/global.h
+++ b/include/types/global.h
@@ -176,6 +176,9 @@
#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 ee7ffd7..8e638c6 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -139,6 +139,7 @@
const char *res, *name;
int *tv = NULL;
int *td = NULL;
+ int warn = 0;
retval = 0;
@@ -147,7 +148,7 @@
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 @@
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 @@
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;