APPLICATION LAYER
PROTOCOL
HTTP
HTTP
• HTTP stands for HyperText Transfer Protocol.
• It is the main way web browsers and servers
communicate to share information on the internet.
• Tim Berner invents it.
• HyperText is the type of text that is specially coded
with the help of some standard coding language
called HyperText Markup Language (HTML).
• It is a set of rules for sharing data on the World Wide
Web (WWW).
KEY POINTS
• Basic Structure: HTTP forms the foundation of the
web, enabling data communication and file sharing.
• Web Browsing: Most websites use HTTP, so when
you click on a link or download a file, HTTP is at
work.
• Client-Server Model: HTTP works on a
request-response system. Your browser (client) asks
for information, and the website’s server responds
with the data.
• Application Layer Protocol: HTTP operates within
the Internet Protocol Suite, managing how data is
transmitted and received.
HYPERTEXT
• The protocol used to transfer hypertext between two
computers is known as HyperText Transfer Protocol.
• HTTP provides a standard between a web browser
and a web server to establish communication.
• It is a set of rules for transferring data from one
computer to another.
HYPERTEXT
• Data such as text, images, and other multimedia files
are shared on the World Wide Web. Whenever a web
user opens their web browser, the user indirectly uses
HTTP.
• It is an application protocol that is used for
distributed, collaborative, hypermedia information
systems.
WORKING OF HTTP
• First of all, whenever we want to open any website we first
open a web browser after that we will type the URL of that
website (e.g., [Link] ).
• This URL is now sent to the Domain Name Server (DNS).
Then DNS first checks records for this URL in their database,
and then DNS will return the IP address to the web browser
corresponding to this URL. Now the browser is able to send
requests to the actual server.
• After the server sends data to the client, the connection will be
closed. If we want something else from the server we should
have to re-establish the connection between the client and the
server.
HTTP Request
• HTTP request is simply termed as the information or
data that is needed by Internet browsers for loading a
website. This is simply known as HTTP Request.
• There is some common information that is generally
present in all HTTP requests. These are mentioned
below.
❖ HTTP Version
❖ URL
❖ HTTP Method
❖ HTTP Request Headers
❖ HTTP Body
❖ HTTP Request Headers
HTTP Request Headers generally store information in the
form of key-value and must be present in each HTTP
Request. The use of this Request Header is to provide core
information about the client’s information, etc.
❖ HTTP Request Body
HTTP Request Body simply contains the information that
has to be transferred. HTTP Request has the information
or data to be sent to these browsers.
❖ HTTP Method
HTTP Methods are simply HTTP Verb. In spite of being
present so many HTTP Methods, the most common HTTP
Methods are HTTP GET and HTTP POST. These two are
generally used in HTTP cases. In HTTP GET, the
information is received in the form of a website.
HTTP Response
• HTTP Response is simply the answer to what a
Server gets when the request is raised. There are
various things contained in HTTP Response, some of
them are listed below.
HTTP Status Code
HTTP Headers
HTTP Body
▪ HTTP Response Headers
HTTP Response headers are simply like an HTTP
Request where it has that work to send some
important files and data to the HTTP Response
Body.
▪ HTTP Response Body
HTTP Responses are the responses that are
received successfully upon the request. Generally,
it comes under the requests generated by the web.
In most cases, the request is to transfer the HTML
data into a webpage.
HTTP Status Code
• HTTP Status Codes are the 3-digit codes that tell the
message or simply tell us about the HTTP Request
whether it has been completed or not. There are
simply 5 types of status codes.
✔ 1x Informative
✔ 2xx Achievement
✔ 3xx Reorientation
✔ 4xx Client Mistake
✔ 5xx Error on the Server
HTTP status code
✔ Different numbers between 00 and 99 are denoted by
the “xx”.
✔ Status codes that begin with “2” denote a successful
outcome.
✔ For instance, the most typical answers sent after a
client requests a webpage have a status code of “200
OK,” which denotes that the request was successfully
fulfilled.
Characteristics of HTTP
• The server processes a request, which is raised by the client,
and also server and client know each other only during the
current bid and response period.
• Any type of content can be exchanged as long as the server
and client are compatible with it.
• Once data is exchanged, servers and clients are no longer
connected.
• It is a request and response protocol based on client and server
requirements.
• It is a connection-less protocol because after the connection is
closed, the server does not remember anything about the client
and the client does not remember anything about the server.
• It is a stateless protocol because both client and server do not
expect anything from each other but they are still able to
communicate.
Advantages of HTTP
• Memory usage and CPU usage are low because of
fewer simultaneous connections.
• Since there are few TCP connections hence network
congestion is less.
• Since handshaking is done at the initial connection
stage, then latency is reduced because there is no
further need for handshaking for subsequent requests.
• The error can be reported without closing the
connection.
• HTTP allows HTTP pipe-lining of requests or
responses.
Disadvantages of HTTP
• HTTP requires high power to establish communication and
transfer data.
• HTTP is less secure because it does not use any encryption
method like HTTPS and uses TLS to encrypt regular HTTP
requests and responses.
• HTTP is not optimized for cellular phones and it is too
gabby.
• HTTP does not offer a genuine exchange of data because it
is less secure.
• The client does not close the connection until it receives
complete data from the server; hence, the server needs to
wait for data completion and cannot be available for other
clients during this time.
HTTP Non-Persistent & Persistent
Connection
• The Hypertext Transfer Protocol (HTTP) is an
application-level protocol that uses TCP as an
underlying transport and typically runs on port 80.
• HTTP is a stateless protocol i.e. server maintains no
information about past client requests.
HTTP Connections
❖ Non-Persistent
❖ Persistent
RTT(Round Trip Time)
Time for a small packet to travel from client to server
and back.
RTT = 2 X propagation time
1. For a connection Persistent or Non-persistent it is sure
that to initiate a TCP connection one RTT is used.
2. One RTT is used for the HTTP request and the first
few bytes to the HTTP response to return. So to know
the total file transmission time.
Total = 2RTT + transmit time
TCP 3-Way Handshake
TCP Connection establishes in 3 ways, that’s why it is
called a 3-way Handshake.
• Requesting the server for the connection.
• The server responds to whether the connection can be
established or not.
• Acknowledgment by the client on the response sent
by the server.
Non-Persistent Connection
• Non-Persistent Connections are those connections in
which for each object we have to create a new
connection for sending that object from source to
destination
• There are two types:
• 1. Non-Persistent-Without parallel connection:
Each objection takes two RTTs (assuming no window
limit) one for TCP connection and the other for HTTP
image/text file.
• 2. Non-Persistent-With parallel connection:
Non-Persistent with a parallel connection requires
extra overhead in transferring data.
Persistent Connection
1. Non-Pipelined Persistent Connection: In a
Non-pipeline connection, we first establish a
connection that takes two RTTs then we send all
the object’s images/text files which take 1 RTT
each (TCP for each object is not required).
2. Pipelined Persistent Connection: In Pipelined
connection, 2RTT is for connection establishment
and then 1RTT(assuming no window limit) for all
the objects i.e. images/text.
Persistent HTTP Non-Persistent HTTP
The server leaves the connection open
Requires 2 RTTs per object.
after sending a response.
Subsequent HTTP messages between the
same client/server are sent over an open OS overhead for each TCP connection
connection.
The client sends requests as soon as it Browsers often open parallel TCP
encounters a referenced object. connections to fetch referenced objects.
As little as one RTT for all the referenced Here, at most one object can be sent over
objects. one TCP Connection.