Let’s Decode HTTP

Pruthwiraj Nayak
3 min readMar 7, 2023
Photo by Alina Grubnyak on Unsplash

Hello fellas! All techies like myself, must have know the terms HTTP. This is a very common terms, but how well exactly we know HTTP!!! Here today, we will discuss from the scratch to the very depth of HTTP.

What is HTTP ?

  • HTTP stands for Hypertext Transfer Protocol.
  • Let’s analyse these 3 words. What does protocol means! Protocol means set of rules. Transfer refers to the transfer of data between client to server. And Hypertext means to text that contains hyperlink.
  • Overall HTTP means “it is a protocol that transfer data between client and server via hyper-linked texts”.
  • HTTP follows client-server architecture.
  • WWW(world wide web) build upon HTTP protocol.
Client-server Architecture

Client Request :

  • In HTTP protocol client sends an request to server, which has mostly 3 parts i.e. HTTP method, headers and data.
  • HTTP methods are GET, HEAD, POST, PUT. GET used for request data from server. HEAD used for getting request headers. POST used for saving data into the server. PUT used for update request inside server.
  • Similarly headers contain accept(file type i.e. “application/json” or “text/html”or …), authorization(user credentials if user needs to authenticate itself on server), user-agent(name & version of client software), host(internet host and port number) and so on…
  • We can only pass request data for POST and PUT request.

Server Response :

  • When server respond to a request, it also contains mostly 3 fields i.e. status code, headers and response data.
  • Status code reflects the state of the response, that means whether response is a success or error. For example 200 returns if server respond successfully, 302 for redirected URI, 401 for unauthorised access error, 404 returns if content not found, and status code returns more than 500 if server doesn’t process the data successfully.
  • Response headers contain server(name and version of server), date(current date), content-length(length of data in bytes), content-type(MIME type of response data) and so on…

If you know about HTTP, then you must have familiar with the term “HTTPS” too. Then what is the difference between HTTP & HTTPS !

  • In HTTPS, “s” stands for secure.
  • HTTP is a non secure protocol. That means it send the data from client to server in plain-text format.
  • HTTPS is a secure protocol. It sends data to the server in encrypted format. It uses SSL/TLS encryption to protect data.

Let’s analyse how HTTPS works :

  • The above diagram is a basic representation of how HTTPS works.
  • From step 1 to step 6, the Handshake is happening between client and server. At the end of step 6 both client and server has unique session key to authenticate each other.
  • From step 7 onwards client and server both encrypt and decrypt their request and response using the unique session key.

Handshake is a signal between two devices or programs, used to, e.g., authenticate, coordinate. Want to learn more about Handshake ? click here

This is all about HTTP. I think this 3 min of your’s was informative. Thanks for the read and have a great day.

--

--