The toy example keeps its boundary narrow.

highlighted = computed this step

What this toy model checks

The trust boundary parses the request, splits the response, counts the body bytes, and compares the count with Content-Length.

recompute body length\text{recompute body length}
Content-Length honesty boundaryThe body bytes and Content-Length check are recomputed from pinned response bytes.Content-Length honesty boundary - 200 OK body hello is 5 bytes, Content-Length 5sectionnamevaluecheckrequest linemethodGETparsedrequest linepath/hello.txtparsedrequest lineversionHTTP/1.1parsedheaderHoststatic.exampleexactheaderAccepttext/plainexactstatusversionHTTP/1.1parsedstatusstatus200 OKokheaderContent-Typetext/plainexactheaderContent-Length5declared bytesbodytexthelloafter blank linebodyhex68656c6c6fASCII bytesbodybyte length5countedcheckContent-Length5declaredcheckbody bytes5recomputedcheckmatchyessame number

Honesty boundary

NOTE: toy HTTP response length only; not chunked transfer, compression, trailers, multiple responses, streaming, range requests, framing, charset negotiation, MIME sniffing, security policy, or production web server config.

toy response length only\text{toy response length only}
Content-Length honesty boundaryThe body bytes and Content-Length check are recomputed from pinned response bytes.Content-Length honesty boundary - 200 OK body hello is 5 bytes, Content-Length 5sectionnamevaluecheckrequest linemethodGETparsedrequest linepath/hello.txtparsedrequest lineversionHTTP/1.1parsedheaderHoststatic.exampleexactheaderAccepttext/plainexactstatusversionHTTP/1.1parsedstatusstatus200 OKokheaderContent-Typetext/plainexactheaderContent-Length5declared bytesbodytexthelloafter blank linebodyhex68656c6c6fASCII bytesbodybyte length5countedcheckContent-Length5declaredcheckbody bytes5recomputedcheckmatchyessame number

No client compute

The page shows already validated rows. It does not count body bytes in browser code.

static validated rows\text{static validated rows}
Content-Length honesty boundaryThe body bytes and Content-Length check are recomputed from pinned response bytes.Content-Length honesty boundary - 200 OK body hello is 5 bytes, Content-Length 5sectionnamevaluecheckrequest linemethodGETparsedrequest linepath/hello.txtparsedrequest lineversionHTTP/1.1parsedheaderHoststatic.exampleexactheaderAccepttext/plainexactstatusversionHTTP/1.1parsedstatusstatus200 OKokheaderContent-Typetext/plainexactheaderContent-Length5declared bytesbodytexthelloafter blank linebodyhex68656c6c6fASCII bytesbodybyte length5countedcheckContent-Length5declaredcheckbody bytes5recomputedcheckmatchyessame number

Summary

Headers come first, then the body; Content-Length counts the body bytes.

Content-Length counts body\text{Content-Length counts body}
Content-Length honesty boundaryThe body bytes and Content-Length check are recomputed from pinned response bytes.Content-Length honesty boundary - 200 OK body hello is 5 bytes, Content-Length 5sectionnamevaluecheckrequest linemethodGETparsedrequest linepath/hello.txtparsedrequest lineversionHTTP/1.1parsedheaderHoststatic.exampleexactheaderAccepttext/plainexactstatusversionHTTP/1.1parsedstatusstatus200 OKokheaderContent-Typetext/plainexactheaderContent-Length5declared bytesbodytexthelloafter blank linebodyhex68656c6c6fASCII bytesbodybyte length5countedcheckContent-Length5declaredcheckbody bytes5recomputedcheckmatchyessame number