4 ms·
HTTP allows the body length to be specified in the header before the body is downloaded via the `Content-Length` header. It also allows you to stream the body i
by brabel 6y ago
HTTP allows the body length to be specified in the header before the body is downloaded via the `Content-Length` header. It also allows you to stream the body in chunks by setting the `Transfer-Encoding` header to `chunked`, as you've mentioned, in which case each chunk starts with its own length. In both cases, the length cannot be faked because the recipient will stop pulling bytes after the specified length, as that's the purpose of sending such length (after there's no more bytes according to the latest length, the connection is free to be used for a subsequent response)!