Deep Dive Into HTTP


There is medium for sharing and receiving data through internet
and That is HTTP
What is HTTP?
HTTP is simple rules or protocal that follows by the client and server to exchange information in internet (world wide web). it is medium through which we receive and send data
It was developed in the early 1990s by Tim Berners-Lee at CERN and is the foundation of data communication for the World Wide Web.
There are client and server and they communicate through http .
it is protocol to send and receive data or information .
HTTP is the dominant and most common protocol for client-server communication.
the client send some http requests to server and server responds back with some HTTP responses like html, css , javascript images etc
HTTP is stateless what does it mean ?
each HTTP request from a client to a server is treated as a completely independent transaction. The server does not retain any memory or knowledge of previous requests from the same client.
what are the benefits for HTTP to be stateless ?
To be stateless , every requests are treated as independent transactions means different requests to the server.
simplicity : It helps to design simple server . the server does not need to handle and keep tracks of record of every clients requests . think if http is stateful then the server need to keep track of each and every clients request which might make server slow to respond
salability : it absolutely helps to make server scalable because the server can handle many request from many clients . because every request are treated independently there is no need to keep to store previous sessions of data of requests of client
Reliability : if server crashes , there is no lose of data because it is stateless protocol . client make new connection to new server
There comes questions if it is stateless then how it keeps our login data ?
There are many ways to keep data on top of http
some of them are :
cookies : small piece of data that stored in client browsers which are sent on each subsequent http requests.
sessions : server side storage of user specific data which are identified by unique session id (mainly in form of cookies
URL Parameters: directly send through query parameters in url
Request-Response Model
The client send some type of data which is sent through Request Headers :
It includes :
Information about client : User-agent (browsers), Referer
Content Negotiation : It tells server about content type client can understand and prefers like Accept:application/json
Authentication and Authorization : Headers provides credentials like Authorization :Bearer sometoken
Request Modifiers and conditions :like Cache-Control
Connection Management :Connection:keep-alive or close , Host :www.exmple.com
Cookies
Content Information for (put and Post )
Response Headers :
Server
Content-Type
cookies
Date
Location
Security
status code
These are information send by client in request header and server respond back in Response Header
Subscribe to my newsletter
Read articles from Dipesh Chaudhary directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
