]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: httpclient: change the init sequence
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 22 Apr 2022 13:16:09 +0000 (15:16 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 22 Apr 2022 13:45:47 +0000 (15:45 +0200)
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.

src/http_client.c

index 57ca92839f9272cb43916ad13a902a599c851f00..0e9621713d5d96de9cba78cb391f59fe71e357f8 100644 (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);