HTTP client flows must comply with the following standards. Any client flow that doesn’t comply with these standards will be automatically rejected.
HTTP Protocol:
- HTTP Version: HTTP messages must include the protocol version in the request or status line (e.g., 'HTTP/1.1').
- HTTP/1.0: If using HTTP version 1.0, only use Content-Length to specify the message body size.
- HTTP/1.1 and later versions: Prefer Transfer-Encoding: chunked for more efficient data transmissions but ensure that Content-Length is not present simultaneously.
Content-Length:
- Definition: The Content-Length header indicates the size of the message body in bytes.
-
Usage:
- Mandatory for response messages containing a body, unless Transfer-Encoding is used with the value chunked.
- Must not be used if Transfer-Encoding: chunked is present.
-
Accuracy:
- Clients must ensure that the size specified in Content-Length matches the size of the received message body.
Transfer-Encoding:
- Definition: The Transfer-Encoding header specifies the encoding(s) used to transfer the message body. Each encoding is applied sequentially, in order, to decode the message body.
-
Values and Usage:
- chunked: Allows for the transfer of data in variable-sized segments, which is useful when the total length of the message body is not known beforehand.
- If Transfer-Encoding: chunked is used, the Content-Length header must be omitted.
- The value chunked must be the last encoding if multiple encodings are used.
For more details, refer to sections 3.3, 3.3.1, 3.3.2, and 3.3.3 of the RFC 7230 standard: