]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: proxy: also look for the closest option among cfg_opts3
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)
proxy_find_best_option() scans cfg_opts[] and cfg_opts2[] for the option
which looks closest to a mistyped one. When cfg_opts3[] was introduced
in 3.2 with commit cc5a66212d ("MINOR: proxy: add proxy->options3"), it
was not added there, so such newly added options are not proposed as
candidates for mistakes (e.g. "assume-rfc6587-ntf" or "dont-parse-log").
Let's just fix this.

This may be backported to 3.2.

src/proxy.c

index 37785a1c52640bf49797936b1d646464556fb809..ee759127a12773fc692b25c1c48603db29cbfaa2 100644 (file)
@@ -597,6 +597,15 @@ const char *proxy_find_best_option(const char *word, const char **extra)
                }
        }
 
+       for (index = 0; cfg_opts3[index].name; index++) {
+               make_word_fingerprint(list_sig, cfg_opts3[index].name);
+               dist = word_fingerprint_distance(word_sig, list_sig);
+               if (dist < best_dist) {
+                       best_dist = dist;
+                       best_ptr = cfg_opts3[index].name;
+               }
+       }
+
        while (extra && *extra) {
                make_word_fingerprint(list_sig, *extra);
                dist = word_fingerprint_distance(word_sig, list_sig);