diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 07d16aa5d..288bd19d7 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1459,12 +1459,18 @@ enum tcpcheck_eval_ret tcpcheck_eval_send(struct check *check, struct tcpcheck_r } else body = send->http.body; - clen = ist((!istlen(body) ? "0" : ultoa(istlen(body)))); - if ((!connection_hdr && !htx_add_header(htx, ist("Connection"), ist("close"))) || - !htx_add_header(htx, ist("Content-length"), clen)) + if (!connection_hdr && !htx_add_header(htx, ist("Connection"), ist("close"))) goto error_htx; + if ((send->http.meth.meth != HTTP_METH_OPTIONS && + send->http.meth.meth != HTTP_METH_GET && + send->http.meth.meth != HTTP_METH_HEAD && + send->http.meth.meth != HTTP_METH_DELETE) || istlen(body)) { + clen = ist((!istlen(body) ? "0" : ultoa(istlen(body)))); + if (!htx_add_header(htx, ist("Content-length"), clen)) + goto error_htx; + } if (!htx_add_endof(htx, HTX_BLK_EOH) || (istlen(body) && !htx_add_data_atonce(htx, body)))