HTTP

As we just have seen, the process of interaction between browsers
and servers seems to be of trivial nature: a connection has to be
established, the browser sends a request to the server, the server
sends a response afterwards the connection is closed. However, in order
to avoid any kind of "misunderstanding" the requests and responses
must have an exactly defined structure. In this section we are going
to examine how the requests and responses of a browser-server
interaction are built up.
Like any other communication between different programs the
communication between a browser and a server is regulated by a
protocol which in this case is called HyperText Transfer Protocol
(HTTP).

HTTP lays down the following syntactical structure for a clients
request:

<method><URL>[<version>][<headers>][<data>]
The items in brackets are optional, i.e. they are not necessarily part
of a HTTP request. <method> describes how the server should
be accessed. Typical examples are: <version> is normally set to HTTP/1.0 and some common <headers>
are: Here is an example for a HTTP request:
GET /path/file.html HTTP/1.0
Accept : text/plain, text/html, image/jpeg



A HTTP response is syntactically structured as follows:

<version><code><reason>[<headers>][<data>]
Again the items in brackets are optional. But every HTTP response
contains informations about the <version> which generally is set
to HTTP/1.0 and information about the requested document.
<code><reason> denote status codes which either indicate that the
request was processed correctly or that an error occurred. The
different status codes are: Examples for common <headers> are: Finally, <data> contains the requested document itself.
Thus, a HTTP response may be given as:
HTTP/1.0 200 Document follows
Date: Wed,21 Aug 1996 14:53:30 GMT
Server: NSCA/1.4.1
Content-type: text/html
Last-modified: Tue, 20 Aug 1996 29:26:42 GMT
Content-length: 3675
...

back to the previous section or continue with some related links