WebDevelopersNotes logo

home-icon Home / Basics / HTTP protocol- What is HTTP?

HTTP protocol- What is HTTP?

HTTP protocol- What is HTTP?

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.

Sponsored Links

Each client-server transaction, whether a request or a response, consists of three main parts

  1. A response or request line
  2. Header information
  3. The body

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:

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.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

How a Computer Engineering student feels, When the PROGRAM Compiles

Sponsored Links


How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]


Apple's first big order - $50,000 - arrived when co-founder Steve Wozniak was still employed with Hewlett-Packard. They had to supply 100 fully built computers. The order value was twice Steve Wozniak's salary at Hewlett-Packard. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy