BUG/MINOR: haterm: cannot reset default "haterm" mode
Some checks are pending
Contrib / build (push) Waiting to run
alpine/musl / gcc (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run

When "mode haterm" was set in a "defaults" section, it could not be
overridden in subsequent sections using the "mode" keyword. This is because
the proxy stream instantiation callback was not being reset to the
default stream_new() value.

This could break the stats URI with a configuration such as:

    defaults
        mode haterm
        # ...

    frontend stats
		bind :8181
		mode http
		stats uri /

This patch ensures the ->stream_new_from_sc() proxy callback is reset
to stream_new() when the "mode" keyword is parsed for any mode other
than "haterm".

No need to backport.
This commit is contained in:
Frederic Lecaille 2026-02-23 17:10:56 +01:00
parent a9dc8e2587
commit ca5332a9c3

View file

@ -669,6 +669,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
else {
/* valid mode, non "haterm" mode.
* Possibly restore the ->stream_new_from_sc() callback
* if set by default for "haterm" mode.
*/
curproxy->stream_new_from_sc = stream_new;
}
curproxy->mode = mode;
if (curproxy->cap & PR_CAP_DEF)