How dose HTTP works?

HTTP, the Hyper text Transfer Protocol, is the application layer protocol that is used to transfer hyper media on the Web. HTTP is the foundation of data communication for the World Wide Web. Hypertext is structured text that uses logical links between nodes containing text. HTTP is the protocol to exchange or transfer hypertext.



When you browse the web and want to read a document, which is somewhere else in the world and probably very far from you, some connections are needed to make it available. In this process, the very first thing is your browser. You start it up and type the URL into it.

However, the picture is still not complete, as the browser can't read the document directly from the disk where it's stored. To read the document, must run it on a web server. A web server is just a computer program that hears the requests from browsers and then execute them.

So what happens next is that the browser contacts the server and requests that server to deliver the document. The server then gives a response which contains the document, and the browser happily displays the content to the user. The server also tells the browser, what kind of document it sending (Like HTML, PDF, TXT etc.) and then browser shows the document with the program it was configured to use for.

The browser will display HTML documents directly, and if there are references to images, Videos, sound clips etc. then browser has been set up to display by request them from the servers. These will be separate requests, and add additional load on the server and network. When the user follows another link the whole sequence starts again.



These requests and responses are issued in HTTP. HTTP only defines what the browser and web server say to each other, not how they communicate. The actual work of moving bits and bytes back and forth across the network is done by TCP and IP.

A Web browser initiates a request to a server, typically by opening a TCP/IP connection. The request itself comprises -
  • a request line,
  • a set of request headers,
  • and an entity
Then the server sends a response that comprise -
  • a status line,
  • a set of response headers,
  • and an entity 
The entity in the request or response can be thought of simply as the payload, which may be binary data. The other items are readable ASCII characters. When the response has been completed, either the browser or the server may terminate the TCP/IP connection, or the browser can send another request.

Comments