]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: fix Host header
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 24 Aug 2021 15:53:03 +0000 (17:53 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 24 Aug 2021 15:53:03 +0000 (17:53 +0200)
THe http_update_update_host function takes an URL and extract the domain
to use as a host header. However it only update an existing host header
and does not create one.

This patch add an empty host header so the function can update it.

src/http_client.c

index fad3368f3690540e0f26376d41741fe55d4f4761..f6621a6db9a5b860fd78a011fee4432532b29676 100644 (file)
@@ -276,6 +276,8 @@ int httpclient_req_gen(struct httpclient *hc, const struct ist url, enum http_me
        sl->info.req.meth = meth;
 
        /* Add Host Header from URL */
+       if (!htx_add_header(htx, ist("Host"), IST_NULL))
+               goto error;
        if (!http_update_host(htx, sl, url))
                goto error;