HTTP Generic Message Format
(Page 1 of 2)
As weve already seen, all of the communication between devices using the Hypertext Transfer Protocol takes place via HTTP messages, of which there are only two types: requests and responses. Clients usually send requests and receive responses, while servers receive requests and send responses. Intermediate devices such as gateways or proxies may send and receive both types of message.
All HTTP messages are created to fit a message structure that the standard calls the generic message format. Like most of the other TCP/IP messaging protocols such as SMTP and NNTP, HTTP messages do not use a binary message format; rather, they are text-based. HTTP messages are based loosely on the electronic mail RFC 822 and 2822 message standards, as well as the Multipurpose Internet Mail Extensions (MIME) standard. I say loosely because HTTP messages are similar in construction to e-mail messages but do not strictly follow all of the e-mail or MIME format requirements. For one thing, not all of the RFC 822 and MIME headers are used; there are other differences as well, which we will soon examine.
The HTTP generic message format is as follows:
You can see that this is pretty much the same as the format used for e-mail messages and for Usenet newsgroup messages too: headers, an empty line and then a message body. All text lines are terminated with the standard CRLF control character sequence; the empty line contains just those two characters and nothing else. The headers are always sent as regular text; the body, however, may be either text or 8-bit binary information, depending on the nature of the data to be sent. (This is another way that HTTP does not adhere strictly to the RFC 822 standard; see the discussion of entities and media types for a full discussion.)
The start line is a special text line that conveys the nature of the message. In a request, this line indicates the nature of the request, in the form of a method, as well as specifying a URI to indicate the resource that is the object of the request. Responses use the start line to indicate status information in reply to a request. More details on the use of the start line can be found in the next two topics that detail request messages and response messages respectively.
Home - Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.