Two Body Endings

A reverse proxy sits in front of an origin server. A client sends this over one connection, exactly as shown, with CRLF line endings.

POST /order HTTP/1.1
Host: shop.example
Content-Length: 5
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: shop.example

The proxy frames the body using Content-Length. The origin frames it using Transfer-Encoding. What does the origin do with the bytes after the terminating chunk, and what does RFC 9112 actually require?

A

The trailing bytes are read as the trailer section that may follow a last-chunk, so they are parsed as header fields and discarded.

B

The origin ends the body at the zero chunk and parses GET /admin as a second request that the proxy never inspected. RFC 9112 says a message with both fields ought to be handled as an error.

C

The origin uses Content-Length because a byte count is more specific than a transfer coding, so it reads 5 bytes and discards the rest.

D

The origin returns 400 Bad Request because the chunked body is shorter than the declared Content-Length.