From 0a5c16a060551ffc94af523e280064027c8aac33 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Fri, 14 Jan 2022 14:08:34 +0100 Subject: [PATCH] BUG/MINOR: httpclient: don't send an empty body 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. (cherry picked from commit e1e045f4d71f85462414d048449c9307886f7c36) Signed-off-by: Willy Tarreau --- src/http_client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/http_client.c b/src/http_client.c index 34e27c6..2fb1b48 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -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; -- 1.7.10.4