From: William Lallemand Date: Fri, 22 Apr 2022 13:16:09 +0000 (+0200) Subject: MEDIUM: httpclient: change the init sequence X-Git-Tag: v2.6-dev7~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c8b0842bb3647283463a5393d816ba1babc2fee;p=thirdparty%2Fhaproxy.git MEDIUM: httpclient: change the init sequence Change the init order of the httpclient, a different init sequence is required to allow a more complicated init. The init is splitted in two parts: - the first part is executed before config_check_validity(), which allows to create proxy and more advanced stuff than STG_INIT, because we might want to use stuff already initialized in haproxy (trash buffers for example) - the second part is executed after the config_check_validity(), currently it is used for the log configuration. --- diff --git a/src/http_client.c b/src/http_client.c index 57ca92839f..0e9621713d 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -983,8 +983,7 @@ static struct applet httpclient_applet = { * Initialize the proxy for the HTTP client with 2 servers, one for raw HTTP, * the other for HTTPS. */ - -static int httpclient_init() +static int httpclient_precheck() { int err_code = 0; char *errmsg = NULL; @@ -1070,7 +1069,7 @@ err: return err_code; } -static int httpclient_cfg_postparser() +static int httpclient_postcheck() { struct logsrv *logsrv; struct proxy *curproxy = httpclient_proxy; @@ -1127,5 +1126,5 @@ err: /* initialize the proxy and servers for the HTTP client */ -INITCALL0(STG_INIT, httpclient_init); -REGISTER_CONFIG_POSTPARSER("httpclient", httpclient_cfg_postparser); +REGISTER_PRE_CHECK(httpclient_precheck); +REGISTER_POST_CHECK(httpclient_postcheck);