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.
This commit is contained in:
William Lallemand 2022-04-22 15:16:09 +02:00
parent b53eb8790e
commit 2c8b0842bb

View File

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