A typical HTTP session consists of the following steps:
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.
GET /index.shtml HTTP/1.1
The GET method is used to request the document /index.shtml using the version 1.1 of HTTP.
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)
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.
HTTP/1.1 200 OK
A complete status code list and its descriptions is given in .
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.
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.
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