Body Handling
HTTP/1.1 defines two mechanisms for framing a request body: Content-Length (fixed-size) and Transfer-Encoding: chunked (variable-size). RFC 9112 Sections 6 and 7 specify how servers must read, validate, and terminate body data.
Key Rules
Content-Length — the sender declares the exact byte count:
“If a valid Content-Length header field is present without Transfer-Encoding, its decimal value defines the expected message body length in octets.” — RFC 9112 Section 6.2
Chunked encoding — body is split into self-terminating chunks:
“The chunked transfer coding wraps content in order to transfer it as a series of chunks, each with its own size indicator, followed by an OPTIONAL trailer section containing trailer fields.” — RFC 9112 Section 7.1
No CL, no TE — with neither header, the body length is zero:
“If this is a request message and none of the above are true, then the message body length is zero (no message body is present).” — RFC 9112 Section 6.3