]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: reinit flags in httpclient_start()
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 17 Feb 2022 11:52:09 +0000 (12:52 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 17 Feb 2022 11:59:52 +0000 (12:59 +0100)
When starting for the 2nd time a request from the same httpclient *hc
context, the flags are not reinitialized and the httpclient will stop
after the first call to the IO handler, because the END flag is always
present.

This patch also add a test before httpclient_start() to ensure we don't
start a client already started.

Must be backported in 2.5.

src/http_client.c

index dacc326be6eb0a08c862f668a14fc219e33c78a5..c8576e7645eb03747c790916e47e8f3ca7a96627 100644 (file)
@@ -423,6 +423,13 @@ struct appctx *httpclient_start(struct httpclient *hc)
        int len;
        struct split_url out;
 
+       /* if the client was started and not ended, an applet is already
+        * running, we shouldn't try anything */
+       if (httpclient_started(hc) && !httpclient_ended(hc))
+               return NULL;
+
+       hc->flags = 0;
+
        /* parse URI and fill sockaddr_storage */
        /* FIXME: use a resolver */
        len = url2sa(istptr(hc->req.url), istlen(hc->req.url), &hc->dst, &out);