MINOR: haterm: add "haterm" run mode

Add new "haterm" new working mode for haproxy frontends only.
This makes the frontends work as haterm HTTP benchmark servers.
All the HTTP protocols are supported.
This commit is contained in:
Frederic Lecaille 2026-02-11 15:11:27 +01:00
parent 04a5b7691a
commit da6b1ef2f6
3 changed files with 28 additions and 3 deletions

View file

@ -9307,6 +9307,9 @@ mode { tcp|http|log|spop }
processing and switching will be possible. This is the mode which
brings HAProxy most of its value.
haterm The frontend will work in haterm HTTP benchmark mode. This is
not supported by backends. See doc/haterm.txt for details.
log When used in a backend section, it will turn the backend into a
log backend. Such backend can be used as a log destination for
any "log" directive by using the "backend@<name>" syntax. Log

View file

@ -18,6 +18,7 @@
#include <haproxy/compression-t.h>
#include <haproxy/connection.h>
#include <haproxy/extcheck.h>
#include <haproxy/hstream.h>
#include <haproxy/http_ana.h>
#include <haproxy/http_htx.h>
#include <haproxy/http_ext.h>
@ -645,9 +646,22 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
mode = str_to_proxy_mode(args[1]);
if (!mode) {
ha_alert("parsing [%s:%d] : unknown proxy mode '%s'.\n", file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
if (strcmp(args[1], "haterm") == 0) {
if (!(curproxy->cap & PR_CAP_FE)) {
ha_alert("parsing [%s:%d] : mode haterm is only applicable"
" on proxies with frontend capability.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
mode = PR_MODE_HTTP;
curproxy->stream_new_from_sc = hstream_new;
}
else {
ha_alert("parsing [%s:%d] : unknown proxy mode '%s'.\n", file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
}
else if ((mode == PR_MODE_SYSLOG || mode == PR_MODE_SPOP) &&
!(curproxy->cap & PR_CAP_BE)) {

View file

@ -366,3 +366,11 @@ void haproxy_init_args(int argc, char **argv)
if (err)
exit(1);
}
/* Dummy arg copier function */
char **copy_argv(int argc, char **argv)
{
char **ret = calloc(1, sizeof(*ret));
*ret = strdup("");
return ret;
}