]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: use a placeholder value for Host header
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 2 Nov 2021 14:22:10 +0000 (15:22 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 2 Nov 2021 14:53:09 +0000 (15:53 +0100)
A Host header must be present for http_update_host() to success.
htx_add_header(htx, ist("Host"), IST_NULL) was used but this is not a
good idea from a semantic point of view. It also tries to make a memcpy
with a len of 0, which is unrequired.

Use an ist("h") instead as a placeholder value.

This patch fixes bug #1439.

src/http_client.c

index a07cf9e26f4417e691dee0fb48c6500395a47d32..35de71af767c656cd3aa1b2ff78151ada9711fa0 100644 (file)
@@ -283,7 +283,7 @@ 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))
+       if (!htx_add_header(htx, ist("Host"), ist("h")))
                goto error;
        if (!http_update_host(htx, sl, url))
                goto error;