HTTP Communication Process

Hypertext Transport Protocol is a client/server protocol. This means that the client and server interact to perform a specified task. For example, when a user clicks a link on a Hypertext Markup Language (HTML) page, it apparently causes that page to be replaced with the new page. What actually happens is more complex.

  1. The client browser uses HTTP commands to communicate with the HTTP server.
  2. A connection is established from the client to the server by means of TCP port 80 (the default).
  3. The request message is sent to the server. The requests are typically for a file consisting of images, audio clips, animation clips, video clips, or another hypertext document.
  4. The server sends a response message with the requested data to the client.

For example, when the user clicks a link on an HTML page, the data in the response message comprises the code used to build the page on the client computer.

  1. The server (in most cases) closes the connection.

Table 1.1 defines some of the terms used to refer to the roles played by participants in, and objects of, the HTTP communication process.

Table 1.1 Terms Used in HTTP Communication

Term

Meaning

connection

A virtual circuit (in the transport layer) established between two application programs for the purpose of communication.

message

The basic unit of HTTP communication. It consists of a structured sequence of octets and is transmitted through the connection.

request

An HTTP request message.

response

An HTTP response message.

resource

A network data object or service that can be identified by a URL.

entity

The information transferred as the payload of a request or response. An entity consists of metainformation in the form of entity-header fields and content in the form of an entity-body.


HTTP Requests

The Simple-Request message to the server is sent in the form of a request method, Uniform Resource Locator (URL), and protocol version. The following is an example of an HTTP request.

get http://www.w3.org/hypertext/WWW/TheProject.html HTTP/1.0

This request uses the elements described in Table 1.2.

Table 1.2 Elements of an HTTP Request

Element

Purpose

get

Specifies the request type.

http:

Specifies the request protocol.

//www.w3.org/hypertext/WWW/TheProject.html

States URL for the object requested.

HTTP/1.0

Indicates that version 1.0 of HTTP will be used.


In a Full Request message, the additional information is followed by a Multipurpose Internet Mail Extensions (MIME) message containing request modifiers, client information, and sometimes body content.

HTTP Server Response Messages

When an HTTP server receives a request, it responds with a status message that includes the message's protocol version and a success or error code, followed by a MIME message containing server information, entity metainformation, and sometimes body content.

Table 1.3 lists examples of server status messages and their meanings. For more information, see Chapter 8, "Troubleshooting an Internet Information Server Installation."

Table 1.3 Explanations for Server Status Messages

Message

Type

Explanation

1xx

Informational

This series of responses is not currently used. They are reserved for future use.

2xx

Success

The action was successfully received, understood, and accepted.

3xx:

Redirection

Further action must be taken in order to complete the request.

4xx

Client Error

The request contains incorrect syntax or cannot be fulfilled.

5xx

Server Error

The server failed to fulfill an apparently valid request.