Under Standing HTTP

HTTP is the underlying protocol in which WEB relies. I am starting the the topic with the belief  that , you knows  basic html . Let’s say

A basic html document which prints Hello world!, If you try to open this document via browser, it will simply parse and displays the document, just like a file reader, It wont trigger or initiate any http request.

There are several reasons behind this, One is,

  • Browser can be used as local file viewer
  • Browser wont initiate any request unless it has a domain or ip(v4,v6) in it’s URI and HTTP Connection is required (Most importantly)
    If you think about OSI or TCP/IP , HTTP comes at the application layer. What does that really means?

It means , http data will be delivered to end 2 end(node to node, client to server, you name it). The payload(http) won’t be opened for any other purposes like routing and all. Don’t think about https ,ssl or tls right now, we can deal it later.

Common port address for http (TCP) is port 80. This means that, if you are accessing http://www.google.com/maps, browser implicitly sends the request to port 80 [Since browser knows that the default port for http is 80], So in final it will become, http://www.google.com:80/maps

So, Next, Who is running  on Port 80 on other end.(say google.com). ?. Web Server .

A Web server is a program that uses HTTP to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Most common Web Server Softwares are Apache, Ngnix, IIS. Dont confuse server with web-server. Server is the whole machine (Say a personal Computer) and web-server is just a software(Like ms-word or paint).

Every Http Request/Response initiated from client or server will have two parts , header and body. Header contains information about that http request and body contains the response, if it has any! See the above attachment which is initiated from a browser to host for accessing a image