Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

HttpCheckResponseFraming

procedure HttpCheckResponseFraming(const aResponse: tHttpResponse; out aChunked: Boolean; out aHasLength: Boolean; out aLength: Integer);
HttpCheckResponseFraming decides how the body is delimited, and REFUSES the shapes that are ambiguous rather than guessing at one. Every refusal here is a message-framing attack or a corrupt peer:

- Content-Length together with Transfer-Encoding (RFC 9112 s6.1). The classic request-smuggling desync: two participants pick different framings and the boundary between "this response" and "the next one" moves.
- a Transfer-Encoding whose FINAL coding is not chunked - we cannot frame it, and pretending otherwise reads the next response as this one's body.
- repeated Content-Length fields that disagree.
- a Content-Length that is not a plain non-negative integer.
- a Content-Length above MaxInt div 2. STRUCTURAL, not policy: this unit compiles with overflow checks off and offset + length is 32-bit, so a value near MaxInt wraps negative and turns "the body has arrived" into a buffer overread. Unbounded means bounded by the arithmetic, not by nothing.

aChunked and aHasLength are never both True on return.