We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Content Length

Take another look at the hard coded HTTP response we sent back:

HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 13

Hello World!

The body includes the trailing newline after Hello World!, so it's 13 bytes.

It includes the content length which the RFC says to include. From RFC9112 6.2:

For messages that do include content, the Content-Length field value provides the framing information necessary for determining where the data (and message) ends.

Assignment

curl -v localhost:42069

Read the error message that is printed out carefully, and answer the question. Curl is mad because it's forced to use the connection close to determine when the response ends because we didn't tell it how long the response is.

In the next lesson, we'll solve this problem.