MINOR: httpterm: add "httpterm" run mode

Add new "httpterm" new working mode for haproxy frontends only.
This makes the frontends work as httpterm 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 ce97d1169c
commit 7574c6a01c
2 changed files with 20 additions and 3 deletions

View file

@ -9295,6 +9295,9 @@ mode { tcp|http|log|spop }
processing and switching will be possible. This is the mode which
brings HAProxy most of its value.
httpterm The frontend will work in httpterm HTTP benchmark mode. This is
not supported by backends. See doc/httpterm.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], "httpterm") == 0) {
if (!(curproxy->cap & PR_CAP_FE)) {
ha_alert("parsing [%s:%d] : mode httpterm 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)) {