]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: proxy: make timeout parser a bit stricter
authorWilly Tarreau <w@1wt.eu>
Thu, 22 May 2014 06:24:46 +0000 (08:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 22 May 2014 06:26:41 +0000 (08:26 +0200)
Twice in a week I found people were surprized by a "conditional timeout" not
being respected, because they add "if <cond>" 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.

src/proxy.c

index 493df70b02b1a7c11e3d9b5a43e76e2f66839278..02103ee11723e3a9576498c128b12e4f5fa9c386 100644 (file)
@@ -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;
 }