HTTPmessages are simple, formatted blocks of data. Take a peek at Figure 3-3 for an example. Each message contains either arequest from a client or a response from a server. They consist ofthree parts: a start line describing themessage, a block of headers containingattributes, and an optional body containingdata.
The start line and headers are just ASCII text, broken up by lines.Each line ends with a two-character end-of-line sequence, consistingof a carriage return (ASCII 13) and a line-feed character (ASCII 10).This end-of-line sequence is written" CRLF.”It is worth pointing out that while the HTTP specification forterminating lines is CRLF, robust applications also should acceptjust a line-feed character. Some older or broken HTTP applications donot always send both the carriage return and line feed.
The entity body or message body (or justplain “body”) is simply an optionalchunk of data. Unlike the start line and headers, the body cancontain text or binary data or can be empty.
In the example in Figure 3-3, the headers give youa bit of information about the body. The Content-Type line tells youwhat the body is—in this example, it is a plain-text document.The Content-Length line tells you how big the body is; here it is ameager 19 bytes.
Message Syntax
All HTTP messages fall into two types: ...