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 57ca928..0e96217 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -983,8 +983,7 @@
* 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 @@
return err_code;
}
-static int httpclient_cfg_postparser()
+static int httpclient_postcheck()
{
struct logsrv *logsrv;
struct proxy *curproxy = httpclient_proxy;
@@ -1127,5 +1126,5 @@
/* 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);