The response headers describe the body before it appears.

highlighted = computed this step

Headers describe the body

Content-Type says the body is text/plain.

Content-Type=text/plain\text{Content-Type}=\text{text/plain}
Response headersThe response rows, body rows, and length check are recomputed from pinned bytes.Response headers - 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

Content-Length declares a byte count

The header declares 5 body bytes.

Content-Length=5\text{Content-Length}=5
Response headersThe response rows, body rows, and length check are recomputed from pinned bytes.Response headers - 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

Headers are not the body

The header rows are read before the blank-line boundary.

headers first\text{headers first}
Response headersThe response rows, body rows, and length check are recomputed from pinned bytes.Response headers - 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

Content-Length is a promise about the body bytes that follow the headers.

declared body count\text{declared body count}
Response headersThe response rows, body rows, and length check are recomputed from pinned bytes.Response headers - 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