]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: don't send an empty body
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 14 Jan 2022 13:08:34 +0000 (14:08 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 14 Jan 2022 17:10:43 +0000 (18:10 +0100)
Forbid the httpclient to send an empty chunked client when there is no
data to send. It does happen when doing a simple GET too.

Must be backported in 2.5.

src/http_client.c

index 34e27c661a7c3fdf3ce538904d269ca87675aa4e..2fb1b486fe1dcebc59c5762ce6536c9c8cd5757c 100644 (file)
@@ -278,6 +278,10 @@ int httpclient_req_gen(struct httpclient *hc, const struct ist url, enum http_me
        htx = htx_from_buf(&hc->req.buf);
        if (!htx)
                goto error;
+
+       if (!hc->ops.req_payload && !isttest(payload))
+               flags |= HTX_SL_F_BODYLESS;
+
        sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth_ist, url, vsn);
        if (!sl) {
                goto error;