The HTTP specifications include the definitions of the HTTP message formats. There are two types of HTTP messages,
request messages and response messages.
HTTP Request Message
The first line of an HTTP request message is
called the request line; the subsequent lines are called the header lines. The request
line has three fields: the method field, the URL fields, and the HTTP version field. The method field can take on several
differenet values, including GET, POST, and HEAD. The great majority of HTTP request messages use
the GET method. The GET method is used when the browser requests an object, whit the requested object
identified in the URL field.
An HTTP client often uses the POST method when the user fills out a form. With a POST message, the user
is still requesting a Web page from the server, but the specific contents of the Web page depends on what the user entered
into the form fields. If the value of the method field is POST, then the entity body contains what the user
entered into the form fields.
A request generated with a form does not necessarily use the POST method. Instead, HTML forms often use
the GET method and include the inputted data in the requested URL. If a form uses the GET method,
has two fields.
The HEAD method is similar to the GET method. When a server receives a request withthe HEAD
method, it responds with an HTTP message but it leaves oththe requested object.
HTTP Response Message
Response message has three sections: an initial status line, six header lines, and
then the entity body. The entity body is the meat of the message--it conatins the requested object
itself. The status line has three fields: the protocol version field, a status code, and a corresponding status message.
The werver uses the Connection: close header line to tell the client header line to tell the client that it
is going to close the TCP connection after sending the message. The Date: header line indicates the time and
date when the HTTP response was created and sent by the server. Note that this is not the time when the object was created
or modified; it is the time when the server retrieves the object from its file system, inserts the object into the response
message, and sends the response message. The Server: header line indicates that the message was generated by
Apache Web server; it is analogous to the User-agent: header line in the HTTP request message. The Last-Modified
(also known as proxy servers): header lline indicated the time and date when the object was created or last modifieed. The
Content-Length: header line indicates teh number of bytes in the object being sent. The Content-Type:
header indicates that the object in the entity body is HTML text.
|