The World Wide Web is nothing but communication between web clients and web servers. Clients are Mobile, Laptop, Computer or any such communication device normally using browsers like Chrome, Internet Explorer, Safari or any such program. for communication clients have to follow a set of rules or procedures for transmitting the data known as protocol. HTTP stands for Hyper Text Transfer Protocol, HTTP is used for such communication in which A client sends an HTTP request to the web, a web server that often computers providing resources and data to client over the network receives the client request the server runs an application to process the request then server returns response to the client. 

The client receives the response and render in a browser. and you can see your requested web page. so, in this video we will learn how HTTP protocol works? so, watch it till the end... When you visit a page on the web, your computer uses the Hypertext Transfer Protocol (HTTP) to download the page from server using Internet. HTTP is an application-level TCP/IP based communication protocol, that is used to transfer data like HTML files, images , query results, etc. on the World Wide Web. HTTP specifies how clients request data will be considered and sent to the server, and how the servers respond to these requests in response. 

When we want to browse the web, we can use phone, laptops, desktops with browser application installed. When user type a Uniform Resource Locator (URL) in the browser like http protocol for fetch the document with slash slash and since we are opening the website of suppose LD College of Engineering so we will write ldce.ac.in and press enter here you can see, it is easy to remember and type nice human-friendly URLs in the browsers, like "ldce.ac.in" , "wikipedia.org", or“google.com”. but as we know in the computer networks each device identified by IP address. So, to get the IP address, the browser uses a DNS resolver to map the domain to an IP address. DNS resolver now gives you IP address for our requested website like ldce.ac.in, once the browser get the IP address of the server computer, hosting the requested URL, it sends the HTTP request. In the first line of HTTP request we have text like this the first word is the HTTP method like "GET". The GET method is used to retrieve information from the server. 


You can use other methods like POST which is used to send data to the server, for example, customer information, file upload using HTML forms. The HEAD method asks for a response identical to that of GET request, but without the response body PUT method replaces the target resource, DELETE method deletes the specified resource, The CONNECT method is used by the client to establish a network connection to a web server over HTTP The OPTIONS describe the communication options for the target resource. 

while TRACE method performs a message loop-back test along the path to the target resource. which is used for debugging purpose at the time of development. next slash indicate the path of resource, here it is server root but if you access contact page it would be like /contact. after that it shows the protocol and its version. here it is HTTP protocol with version 1.1. other thing in header is the Host which specifies the domain name and port number of the server to which the request is being sent. here host is ldce.ac.in and HTTP will use default port 80 once it is not specified. next information is for the key like connection, which have value like keep-alive indicate the connection is persistent and not closed. User Agent identify the application and for most of the browser it shows Mozilla and operating system like Windows. 


Accept tells about the client is able to understand text like html, application like xhtml plus xml and various image formats like jxr and many other formats. The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand. here it is like gzip and deflate. Accept-Language tells about which natural language client understands. in our example client understand US English as a language. 

Now this entire request goes to server. Server understands the request and process using various server side scripting language like PHP, Java, ASP etc. and sometimes get the data from databases and generate the page for you, server send it back to client via HTTP response. HTTP response contain status line containing protocol with version number and status code. status code 200 tells request is OK. status code is 3-digit integer where first digit of the status code defines the class of response. 


If it is 1 it shows status is Informational, 2 is for success, 3 is for redirection, 4 says about client error, while 5 is for server error, the important status code like, 100 Continue, this status code tells about client should continue with the request while, 202 Accepted, tells the request is accepted for the processing, but the processing is not complete. 302 Found, tells the requested page has moved temporarily to the new URL. 400 Bad Request says about server did not understand the request. 401 Unauthorized says the requested page needs the username and password. 404 Not Found tells us the server can not find the requested page. While status code like 500 tells us Internal Server Error. 

After status line we have different key value pairs in the HTTP response header like Cash-control tells about The maximum amount of time a resource is considered fresh. Connection is persistent so it shows Keep-Alive. Sever encoded the content with gzip compression techniques given in the content encoding. Content length tells about how many bytes are there in the response. 


While content type indicate content type return by the server along with the character set, in our example it is text/html. Date gives the date and time at which the message was originated. and Expires shows the time till you can considered your resource is fresh here we have max-age=1 so, after 1 second our resource is considered expired. X-Clockwork-Id contain the unique identifier for the HTTP request. X-Clockwork-Version tells the version number. X-Powered-By tells about web application technology like PHP in the HTTP response. 

after this type of header information there will be one empty line indicating end of header section after that, there will be message body containing whole html for our webpage in response. This entire response come back to the client at last, when browser get the response, it understand the response and renders it, and you can see nice webpage of LD College of Engineering. 

If you want to see the header informations in your browser you can open your browse like Internet Explorer and right click and open inspect element. You can see various tabs here in which you go to the network tab and refresh the page. click on the particular name or path and you can see all your request and response header along with all the values here. That’s all about HTTP protocol. I hope you understands all the basics about HTTP protocol. Thanks and bye bye…