From: Willy Tarreau Date: Thu, 22 May 2014 06:24:46 +0000 (+0200) Subject: MEDIUM: proxy: make timeout parser a bit stricter X-Git-Tag: v1.5-dev26~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fac5b5956b84e40358a7a3162be654baddc24e25;p=thirdparty%2Fhaproxy.git MEDIUM: proxy: make timeout parser a bit stricter Twice in a week I found people were surprized by a "conditional timeout" not being respected, because they add "if " after a timeout, and since they don't see any error nor read the doc, the expect it to work. Let's make the timeout parser reject extra arguments to avoid these situations. --- diff --git a/src/proxy.c b/src/proxy.c index 493df70b02..02103ee117 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -233,6 +233,11 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy, } } + if (*args[2] != 0) { + memprintf(err, "'timeout %s' : unexpected extra argument '%s' after value '%s'.", name, args[2], args[1]); + retval = -1; + } + *tv = MS_TO_TICKS(timeout); return retval; }