Tag: Purpose of HTTP Protocol

HyperText Transfer Protocol | HTTP Tutorial

Application Layer Protocols-


Important application layer protocols are-



  1. Domain Name Service (DNS)
  2. Hyper Text Transfer Protocol (HTTP)
  3. Simple Mail Transfer Protocol (SMTP)
  4. Post Office Protocol (POP)
  5. File Transfer Protocol (FTP)


In this article, we will discuss about Hyper Text Transfer Protocol (HTTP).


Hyper Text Transfer Protocol-


  • HTTP is short for Hyper Text Transfer Protocol.
  • It is an application layer protocol.




  • It is mainly used for the retrieval of data from websites throughout the internet.
  • It works on the top of TCP/IP suite of protocols.




HTTP uses a client-server model where-

  • Web browser is the client.
  • Client communicates with the web server┬áhosting the website.



Whenever a client requests some information (say clicks on a hyperlink) to the website server.

The browser sends a request message to the HTTP server for the requested objects.



  • HTTP opens a connection between the client and server through TCP.
  • HTTP sends a request to the server which collects the requested data.
  • HTTP sends the response with the objects back to the client.
  • HTTP closes the connection.


HTTP Connections-


HTTP connections can be of two types-

  1. Non-persistent HTTP connection
  2. Persistent HTTP connection



Non-persistent HTTP connectionPersistent HTTP connection
Non-persistent HTTP connection is one that is used for serving exactly one request and sending one response.Persistent HTTP connection is one that can be used for serving multiple requests.
HTTP server closes the TCP connection automatically after sending a HTTP response.HTTP server closes the TCP connection only when it is not used for a certain configurable amount of time.
A new separate TCP connection is used for each object.A single TCP connection is used for sending multiple objects one after the other.
HTTP 1.0 supports non-persistent connections by default.HTTP 1.1 supports persistent connections by default.



Suppose a request has been made for a HTML page that contains 10 images (called objects).


With non-persistent connection, all the 11 objects (1 page + 10 images) will be sent one by one.

For getting each object, a new separate connection will be opened and used.



Suppose a request has been made for a HTML page that contains 10 images (called objects).


With persistent connection, all the 11 objects (1 page + 10 images) will be sent one after the other using a single TCP connection.



Important Notes-




HTTP uses TCP at the transport layer.


This is because-

  • Unlike UDP, it guarantees the delivery of data via a Three-way handshake.
  • It ensures the re transmission of lost packets.
  • HTTP does not have any inbuilt facility for providing reliability.
  • So, if HTTP uses UDP, then it will have to maintain or handle the session on its own.
  • For example- If a packet gets lost, then HTTP will have to re-transmit the packet.




It is important to know-

  • Any service which does not use TCP should have the inbuilt facility for providing reliability.




HTTP uses port number 80.


  • HTTP clients uses port 80 to send and receive requested web pages from a HTTP server.
  • Similarly, HTTP server responds to all the requests at port 80.




HTTP 1.0 is non-persistent and HTTP 1.1 is persistent.


  • Already discussed in the above table.
  • Persistent connections improve the performance by 20%.




HTTP 1.0 is a connectionless protocol.


This is because-

  • After serving the single HTTP request, the connection is closed and it is not used again.
  • So, HTTP 1.0 without connection keep alive is connectionless.




HTTP is an in-band protocol.


This is because-

  • HTTP passes the┬ácontrol data (commands) and main data over the same connection.
  • Both control data and main data are processed in the same way without any distinction.
  • No high priority is given to the control data (commands).




HTTP is a stateless protocol.


This is because-

  • HTTP server does not maintain any state.
  • It forgets about the client after sending the response.
  • It treats every new request independently.
  • HTTP closes the connection automatically after generating the response for each request.
  • This ensures that no client can engage connection with web server for a long time.


What If HTTP Is Stateful Protocol?


If HTTP is a stateful protocol, then-

  • It will give a chance to the browser window to engage the connection with the web server for a long time.
  • This may unnecessarily create a situation of reaching to maximum connections of a web server even though most of the connections are idle.


To gain better understanding about HTTP Protocol,

Watch this Video Lecture


Next Article- Simple Mail Transfer Protocol | SMTP


Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.