From 7574c6a01cd548c4000bf60a60f7fbafe9e3ff30 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Wed, 11 Feb 2026 15:11:27 +0100 Subject: [PATCH] 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. --- doc/configuration.txt | 3 +++ src/cfgparse-listen.c | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 187ef4d1b..015d00a14 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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@" syntax. Log diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 9a680ef09..2cc5f5bd5 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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)) {