HTTP Protocol : Request and Response


HTTP stands for Hypertext Transfer Protocol.

HTTP is based on the client-server architecture model and a stateless request/response protocol that operates by exchanging messages across a reliable TCP/IP connection.

An HTTP "client" is a program that establishes a connection to a server for the purpose of sending one or more HTTP request messages. An HTTP "server" is a program that accepts connection in order to server HTTP request by sending HTTP response messages.

 Errors on the Internet can be quite frustrating - especially if you do not know the difference between a 404 error and 502 error.

These error message , also called HTTP status codes are response codes given by web servers and help identify the cause of the problem. 


For example - "404 File Not Found" is a common HTTP status code. It means the web server cannot find the file you requested. The file -- the web page or other document you try to load in your web browser has either been moved or deleted, or you entered the wrong URL or document name.

There are four types of HTTP message headers :

Gender-header :
                         These header fields have general applicability for both request and response message.

Request-header :
                         These header fields have applicability only for response messages.

Response-header :
                            These header fields have applicability only for response messages.

Entity-header :
                       These header fields define Meta information about the entity-body.

For example, the browser translated the URL http://www.test101.com/doc/index.html into the following request message :

GET/docs/index.html HTTP/1.1
Host : www.test101.com
Accept: image /gif ,image/jpeg,*/*
Accept-Language: en-us
Accept-Encoding : gzip, deflate
User-Agent: Mozilla/4.0