From 927884a3eb76b6dfdffab399f6ef60cdd6344cef Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 29 Jul 2025 08:29:11 +0200 Subject: [PATCH] MINOR: applet: Add a flag to know an applet is using HTX buffers Multiplexers already explicitly announce their HTX support. Now it is possible to set flags on applet, it could be handy to do the same. So, now, HTX aware applets must set the APPLET_FL_HTX flag. --- addons/promex/service-prometheus.c | 2 +- include/haproxy/applet-t.h | 1 + src/cache.c | 2 +- src/hlua.c | 2 +- src/http_client.c | 2 +- src/stats-html.c | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 74310a366..60f927553 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -2144,7 +2144,7 @@ static void promex_appctx_handle_io(struct appctx *appctx) struct applet promex_applet = { .obj_type = OBJ_TYPE_APPLET, - .flags = APPLET_FL_NEW_API, + .flags = APPLET_FL_NEW_API|APPLET_FL_HTX, .name = "", /* used for logging */ .init = promex_appctx_init, .release = promex_appctx_release, diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index da6dc5024..e10c8240f 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -83,6 +83,7 @@ static forceinline char *appctx_show_flags(char *buf, size_t len, const char *de #define APPLET_FL_NEW_API 0x00000001 /* Set if the applet is based on the new API (using applet's buffers) */ #define APPLET_FL_WARNED 0x00000002 /* Set when warning was already emitted about a legacy applet */ +#define APPLET_FL_HTX 0x00000004 /* Set if the applet is using HTX buffers */ /* Applet descriptor */ struct applet { diff --git a/src/cache.c b/src/cache.c index 7e86e6b96..52abe7d2c 100644 --- a/src/cache.c +++ b/src/cache.c @@ -3139,7 +3139,7 @@ INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_actions); struct applet http_cache_applet = { .obj_type = OBJ_TYPE_APPLET, - .flags = APPLET_FL_NEW_API, + .flags = APPLET_FL_NEW_API|APPLET_FL_HTX, .name = "", /* used for logging */ .fct = http_cache_io_handler, .rcv_buf = appctx_htx_rcv_buf, diff --git a/src/hlua.c b/src/hlua.c index 5d17685f6..e8e2f90cf 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -11611,7 +11611,7 @@ static enum act_parse_ret action_register_service_http(const char **args, int *c /* Add applet pointer in the rule. */ rule->applet.obj_type = OBJ_TYPE_APPLET; - rule->applet.flags = APPLET_FL_NEW_API; + rule->applet.flags = APPLET_FL_NEW_API|APPLET_FL_HTX; rule->applet.name = fcn->name; rule->applet.init = hlua_applet_http_init; rule->applet.rcv_buf = appctx_htx_rcv_buf; diff --git a/src/http_client.c b/src/http_client.c index 875be1199..d72d75ba3 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -1022,7 +1022,7 @@ void httpclient_applet_release(struct appctx *appctx) /* HTTP client applet */ static struct applet httpclient_applet = { .obj_type = OBJ_TYPE_APPLET, - .flags = APPLET_FL_NEW_API, + .flags = APPLET_FL_NEW_API|APPLET_FL_HTX, .name = "", .fct = httpclient_applet_io_handler, .rcv_buf = appctx_htx_rcv_buf, diff --git a/src/stats-html.c b/src/stats-html.c index cd93630f6..e533535a8 100644 --- a/src/stats-html.c +++ b/src/stats-html.c @@ -2103,7 +2103,7 @@ static void http_stats_release(struct appctx *appctx) struct applet http_stats_applet = { .obj_type = OBJ_TYPE_APPLET, - .flags = APPLET_FL_NEW_API, + .flags = APPLET_FL_NEW_API|APPLET_FL_HTX, .name = "", /* used for logging */ .fct = http_stats_io_handler, .rcv_buf = appctx_htx_rcv_buf,