From: Willy Tarreau Date: Tue, 15 Sep 2026 14:37:58 +0000 (+0200) Subject: BUG/MINOR: cfgparse-listen: complete the list of options for the suggestions X-Git-Tag: v3.5-dev9~157 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=3fac6c417b2717acc303d4a54dd37b0871571ed1;p=haproxy.git BUG/MINOR: cfgparse-listen: complete the list of options for the suggestions The options which need a dedicated parsing are not described in the cfg_opts* arrays, so they are listed in common_options[] in order to be proposed as a suggestion when one of them is mistyped. That list was incomplete and was missing "accept-invalid-http-request", "accept-invalid-http-response", "forceclose", "http-restrict-req-hdr-names", "http-tunnel", "http_proxy", "httpslog" and "use-small-buffers", and it spelled "originalto" as "original-to", so none of these ever got suggested: $ printf 'backend b\noption originalt\n' | ./haproxy -c -f /dev/stdin [ALERT] : parsing [/dev/stdin:2] : unknown option 'originalt'. In addition "spop-check" was listed unconditionally while the option only exists when SPOE is enabled, so a build spoe would propose it but fail to recognize it: [ALERT] : unknown option 'spop-chek'; did you mean 'spop-check' maybe ? ... [ALERT] : unknown option 'spop-check'; did you mean 'tcp-check' maybe ? The list is now sorted, complete and conditional where needed, and it received a comment saying that it must be kept in sync with the options. Note that the existing cfg_opts* already handle a few special cases like disabled or obsolete options. Maybe we could extend it to also support special options that are just not parsed there and must appear somewhere else. This could even further simplify the parser by preserving PR_CAP_* to let the main parser handle incompatibilities. This may be backported to all supported versions. --- diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index cd2b43369..122687aec 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -58,12 +58,23 @@ static const char *common_kw_list[] = { NULL /* must be last */ }; +/* Options which are not described in the cfg_opts* arrays because they need a + * dedicated parsing, and which are only used as suggestions for mistyped + * words. This list must be kept in sync with the options which have a + * dedicated parsing below. + */ static const char *common_options[] = { - "httpclose", "http-server-close", "http-keep-alive", - "redispatch", "httplog", "tcplog", "tcpka", "httpchk", - "ssl-hello-chk", "smtpchk", "pgsql-check", "redis-check", - "mysql-check", "ldap-check", "spop-check", "tcp-check", - "external-check", "forwardfor", "original-to", "forwarded", + "accept-invalid-http-request", "accept-invalid-http-response", + "external-check", "forceclose", "forwarded", "forwardfor", + "http-keep-alive", "http-restrict-req-hdr-names", + "http-server-close", "http-tunnel", "http_proxy", "httpchk", + "httpclose", "httplog", "httpslog", "ldap-check", "mysql-check", + "originalto", "pgsql-check", "redis-check", "redispatch", "smtpchk", +#if defined(USE_SPOE) + "spop-check", +#endif + "ssl-hello-chk", "tcp-check", "tcpka", "tcplog", + "use-small-buffers", NULL /* must be last */ };