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
This commit is contained in:
Aurelien DARRAGON 2025-06-27 12:15:24 +02:00
parent 23e5f18b8e
commit 14d68c2ff7

View File

@ -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;