From: Aurelien DARRAGON Date: Fri, 27 Jun 2025 10:15:24 +0000 (+0200) Subject: MEDIUM: server: move _srv_check_proxy_mode() checks from server init to finalize X-Git-Tag: v3.3-dev3~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14d68c2ff7fc0ae17594880abf08740e84c5aeb3;p=thirdparty%2Fhaproxy.git MEDIUM: server: move _srv_check_proxy_mode() checks from server init to finalize _srv_check_proxy_mode() is currently executed during server init (from _srv_parse_init()), while it used to be fine for current checks, it seems it occurs a bit too early to be usable for some checks that depend on server keywords to be evaluated for instance. As such, to make _srv_check_proxy_mode() more relevant and be extended with additional checks in the future, let's call it later during server finalization, once all server keywords were evaluated. No change of behavior is expected --- diff --git a/src/server.c b/src/server.c index 496b00b4c..cfb2db3df 100644 --- a/src/server.c +++ b/src/server.c @@ -3680,14 +3680,6 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg, } free(fqdn); - if (!(curproxy->cap & PR_CAP_LB)) { - /* No need to wait for effective proxy mode, it is already known: - * Only general purpose user-declared proxies ("listen", "frontend", "backend") - * offer the possibility to configure the mode of the proxy. Hopefully for us, - * they have the PR_CAP_LB set. - */ - return _srv_check_proxy_mode(newsrv, 0); - } return 0; out: @@ -3845,6 +3837,15 @@ static int _srv_parse_finalize(char **args, int cur_arg, } #endif + if (!(srv->proxy->cap & PR_CAP_LB)) { + /* No need to wait for effective proxy mode, it is already known: + * Only general purpose user-declared proxies ("listen", "frontend", "backend") + * offer the possibility to configure the mode of the proxy. Hopefully for us, + * they have the PR_CAP_LB set. + */ + return _srv_check_proxy_mode(srv, 0); + } + srv_lb_commit_status(srv); return 0;