1.4.1. A typical HTTP session

A typical HTTP session consists of the following steps:

  1. The user agent contacts the origin server at a designated port. The default port for HTTP is the port 80. An underlying TCP connection needs to be established before, in order to send the whole data over a virtual connection.

  2. The user agent sends a media object request in form of an HTTP request method, a Uniform Request Identifier (URI) and the protocol version. For example:

    GET /index.shtml HTTP/1.1

    The GET method is used to request the document /index.shtml using the version 1.1 of HTTP.

  3. The user agent may send optional client or so-called header information to inform the origin server about its identity and capabilities. All header information are transmitted line by line, each line with a header name, a colon and a value. For example:

    User-agent: Palmscape/PR5 (PalmPilot Pro; I)


    User-agent: Mozilla/1.22 (compatible; MMEF20; Cellphone; Sony CMD-Z5)

    Accept: text/html,image/gif,image/jpeg,text/vcard,text/vcal,application/vnd.wap.wmlc,application/vnd.wap.wmlscriptc,image/vnd.wap.wbmp,*/*

    The first example contains only the user agent's identity and version number. In the second example, the user agent also tells the origin server its media object preferences in terms of Multipurpose Internet Mail Extensions (MIME) types. One example: text/html means, that the user agent is able to render or handle HTML documents.

    To end the header information, the user agent sends a blank line.

The origin server hopefully finds the file index.shtml in the server's root directory and responds with a response message.

  1. The first line of a response message is the status line. The status line contains the protocol version and a numeric three-digit status code and its textual description. For example:

    HTTP/1.1 200 OK

    A complete status code list and its descriptions is given in [22].

  2. The response message may also contain additional header information which give information about the resource and the server. For example:

    Date: Tue, 20 Mar 2001 20:09:40 GMT
    Server: Apache/1.3.9 (Win32) ApacheJServ/1.1.2
    Last-Modified: Wed, 29 Nov 2000 23:53:46 GMT
    ETag: "0-3d8-3a24a7fa"
    Content-Length: 984
    Connection: close
    Content-Type: text/html

    To end the response message, the server sends a blank line.

  3. Since the server could successfully process the user agent's request, the response also contains a body carrying the resource requested. The "Content-Type" response header field in the example above specifies the media type, i.e. text/html. In our example, the body is an HTML page.

  4. The server terminates the underlying TCP connection.

Most HTTP/1.0 implementations use new TCP connections per HTTP request/response pair. In HTTP/1.1, a TCP connection can be used to transmit multiple HTTP requests and responses, so that the user agent may send multiple requests without waiting for the responses.

Copyright © 2001-2003 by Rainer Hillebrand and Thomas Wierlemann