Introduction to HTTP - Hypertext Transfer Protocol

By: Atul Jindal

HTTP is one of the most successful and widely used protocols on the Internettoday. It is application-layer protocol used to transmit and receive hypertextpages. HTTP allows a client usually a web browser to send a simple request andreceive response back from the server. Whenever you write a URL in address barof you browser, your browser firstly contacts the web server, web serverlocates the requested page and sends the appropriate response. These requestsand responses are issued in HTTP.

Each HTTP cycle has following steps:

Connection

The connection is established between a web browser and a web server. Theconnection is established via TCP/IP protocols over particular port generallyport 80 is used. However, HTTP is not used to establish connection, it onlydefines the rules that specify how they communicate.

Request

The web browser sends a request to server, specifying the resource toretrieve. HTTP defines the set of rules for sending the request. Every HTTPrequest consists of Request-Line, Request-Headers and Message-Body. Sample HTTPrequest is shown below.

GET /index.htm HTTP/1.1

HOST: www.google.com

Accept: text/html, text/plain

User-Agent: Mozilla/4.0

Each HTTP request has request line and consists of request methods, URI, andHTTP version. After Request-Line, Request-Header starts and providing thecharacteristics associated with data returned.

Response

It is the response send by the web server to client. The server firstlylocates the requested document and sends the appropriate response. Howeverthere is a format specified by HTTP to send the response from server. EveryHTTP response consists of Status-Line, Response-Headers and Message-Body.Sample HTTP response is shown below.

HTTP/1.1 200 OK

Server: Apache/1.3.3.7

Date: Mon, 23 May 2005 22:38:34 GMT

Accept-Ranges: bytes

Content-Type: text/html

Content-Length: 512

Last-Modified: Tue, 18 Jan 2007 10:12:30 GMT

Connection: close

hello worldHello world

The first line of the every HTTP response is called the Status-Line andconsists of numeric status code returned along with reason phrase. It is theresponse returned associated with the HTTP request. After Status-Line,Response-Header starts and providing the characteristics associated with datareturned.

Close

Finally connection is closed. After each request and response cycle theconnection is closed. Each time the web browser makes requestPsychology Articles, new connectionis established. There is no account for the previous requested resource on webserver or I can say that there is no session maintained. This makes HTTP astateless protocol.

Computers
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 

» More on Computers