]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: cfgparse-listen: complete the list of options for the suggestions
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2026 14:37:58 +0000 (16:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2026 07:22:33 +0000 (09:22 +0200)
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.

src/cfgparse-listen.c

index cd2b43369cddc0af274e94eaa96270d23ca1637b..122687aece037a1bf27acc184bc0be77745afd7a 100644 (file)
@@ -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 */
 };