Computers on the World Wide Web use the HyperText Transfer Protocol to talk with each other. The HTTP provides a set of instructions for accurate information exchange. The communication between the client (your browser) and the server (a software located on a remote computer) involves requests sent by the client and responses from the server.
The terms “client” and “server” have been taken from real life scenario of a customer (client) and a waiter (server) in a restaurant. With that analogy in mind, you should be able to grasp the idea of HTTP better.
Each client-server transaction, whether a request or a response, consists of three main parts
A client connects to the server at port 80 (unless it has been changed by the system administrator) and sends a request. The request line from the client consists of a request method, the address of the file requested and the HTTP version number.
GET /mypage.html HTTP/1.1
The above request calls for mypage.html file using the GET HTTP method; the version of HTTP used is 1.1.
After the request line comes the header data that consists of configuration information about the client and its document viewing preferences. The header is a series of lines, each of which contains a specific detail about the client and ends with a blank line. A header may look like this:
ACCEPT: */* ACCEPT_LANGUAGE:en-us REFERER:http://www.simplygraphix.com/wedes.html USER_AGENT:Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) ...
Most of the lines in the header are self-explanatory. The ACCEPT identifies the various kinds of files which the client can display. The REFERER lines contains the document from which the request was generated. In the case above, it is webdes.html document from http://www.simplygraphix.com web site that has sent the request. the The USER_AGENT specifies the browser and gives details on its version number.
The body of the request will contain data sent by the client via POST method.
The server now responds. Again, the response consists of three parts.
The response line contains information on the HTTP version number, a status code that indicates the result of the request from the client and a description of the status code in ‘English’.
HTTP/1.1 200 OK
The HTTP version used is 1.1 and the status code 200 and ‘OK’ explain the result of the client’s request. There are many HTTP server status codes and you can know more about them through the links given at the end of this page.
The header from the server contains information about the server software and the document sent to the client.
Date: Wed, 16 Aug 2000, 13:25:54 GMT Server: NCSA/1.5.2 Last-modified: Sat, 22 Jan 2000, 05:15:43 Content-type: text/html Content-length: 12443
The header is followed by a blank line that indicates the end of the header information. From the example above, the server sends an html document of size 12443 bytes as shown by the Content-type and Content-length lines. The server line gives details about the server software. The rest is quite evident.
One last point on the HTTP protocol- HTTP is a stateless protocol, which means that the connection between the browser and the server is lost once the transaction ends.
The Commodore PET (Personal Electronic Transactor) was the first personal computer to be available off the shelf on retail stores. Another product from the company, the Commodore 64, is regarded as the largest selling computer of all time. Commodore International was founded by Jack Tramiel, a Polish-American businessman. Unfortunately, the company failed to maintain its initial success and filed for bankruptcy on 29th April 1994. [more...]