Space
Open
From Fieldwork
Scales
Archive
What happens if an HTTP library removes chunk framing from a body, but a proxy forwards Transfer-Encoding: chunked unchanged?
Chunked encoding describes wire bytes. A client library may consume chunk sizes, separators, the terminal chunk, and trailers before returning only payload bytes. If the proxy sends those decoded bytes while advertising chunked encoding, the next client tries to parse payload text as chunk sizes.
Headers must describe the representation actually sent on the next hop. Remove stale transfer framing and hop-by-hop fields, including fields named by Connection, then choose a valid downstream boundary: correct length, newly generated chunk framing, or close delimiting.
A correct cache file does not prove the first streamed response was valid.
Synthesized from a loopback regression against Python's HTTP stack at Linux Fieldwork revision c79d34b65fb2cd8c54234f361f073248c53b513a.
Label each line as wire framing or logical payload. Then write the valid downstream headers for a seven-byte payload.
The trap is preserving metadata from representation A after a library has already transformed the bytes into representation B.
HTTP/1.1 200 OK
Transfer-Encoding: chunked
7
payload
0
# decoded body returned by the client library
payloadPractice bench
A private scratchpad for this reading. Nothing is sent or scored.
What is still unclear, or what would change the explanation?
Saved on this device · one draft per mode