diff --git a/doc/configuration.txt b/doc/configuration.txt index 59c3e5fd1..40e91f9bc 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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@" syntax. Log diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 9a680ef09..3bce9dd0b 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], "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)) { diff --git a/src/haterm_init.c b/src/haterm_init.c index 86f652937..89a92b66c 100644 --- a/src/haterm_init.c +++ b/src/haterm_init.c @@ -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; +}