How HTTP Protocol Works!

Arun prashanth
5 min readMay 16, 2021

--

Photo by Google

Before starting to know this topic if you want get a clear understanding first you have to know about the OSI Model. First, go through this blog after that get a clear picture of the HTTP protocol.

Every day of our life, we have to interact with the internet with the use of communication protocol. This communication protocol is HTTP. This is referred to as HyperText Transfer Protocol.

What is HyperText Transfer Protocol? before that, we must know about the protocol.

Protocol

It’s a standard set of rules or procedures that allows electronic devices are communicating with each other.

These rules include:
● what type of data may be transmitted
● what commands are used to send and receive data
● how data transfers are confirmed

Let’s you have to think of a protocol as a spoken language. So each language has its own vocabulary and languages if two people share the same language then they have to communicate very effectively. Like that, if two hardware devices support the same protocol, they can communicate with each other, regardless of the manufacturer or type of device.

Protocol Icon

HyperText Transfer Protocol

The internet can contain a vast number of resources hosted on different servers. As for that access these resources, the browser needs to be able to send a request to the servers and display the resources via any devices.

HTTP is a foundation of worldwide web and used to load web pages using hypertext links. HTTP is an Application Layer protocol(Web’s Application Layer Protocol). So it’s designed for transfer data within devices to exchange information. The basic flow is happening through involves a client machine making a request to a server, which then sends a response message.

HTTP Request

An HTTP request is a web browser that asks for the information they need to load a website. The information carried away of encoded data it’s called a Request. These requests are sent via HTTP protocol.

How Do HTTP Requests Work?

The request work between client and servers by the intermediary transportation method. As for that client submits an HTTP request to the server and after some internal process, the requests’ response will be sent back. The response contains status information about the request.

HTTP request typically contains:

1. HTTP version type
2. a URL
3. an HTTP method
4. HTTP request headers
5. Optional HTTP body.

HTTP method

An HTTP request is an action to be performed on a resource identified by a given Request-URL. These methods are case-sensitive and case-sensitive. There are various HTTP request methods/ HTTP verb, but each one is assigned a specific purpose.

Various Types of HTTP Request Methods:

GET- Used to retrieve and request data from a specified data in a server. and used to retrieve whatever information is identified by the Request-URL.
POST- Used to create a resource. The information submitted to the server with the POST request method is archived in the request body of the HTTP request.
PUT- Used to send data to the server to create or update a resource. The difference between the two put methods are called the same PUT requests multiple times, the results will always be the same.
DELETE- Used to delete resource specified URL. DELETE request will remove the targeted resource.
PATCH- It’s similar to the POST and PUT method.Used to small modifications in the resource.
TRACE- Used to invoke loop-pack test along the path to the target resource.
CONNECT- Used by the client to create a network connection to a web server over a particular HTTP.

HTTP Headers

This contains text information stored in key-value pairs and included request and response message. These headers communicate core information.

Example of HTTP Headers

HTTP Response

The result of an HTTP request is an HTTP response.

A typical HTTP response contains:
1. an HTTP status code
2. HTTP response headers
3. optional HTTP body

1.HTTP Status Codes

These codes are used to convey the results of a client request. There are 5 categories.

● 100–200: Informational Messages
● 200–300: Success Messages
● 300–400:Redirect Messages
● 400–500: Client Errors
● 500–600: Server Errors

2. HTTP Response headers

Like an HTTP request, an HTTP response comes with headers that convey important information.

Example of HTTP Response Header

HTTP Response body

Generally, HTTP response “GET” requests are in the body part. most web requests, this is HTML data that a web browser will translate into a web page.

HTTP 1.0 VS HTTP 1.1

HTTP 1.0 that uses TCP request for every connection.HTTP1.0 defined a limited number of status codes at 16. This is much more costly because every time needs a TCP connection. And there are some issues are having with using HTTP 1.0 due to that overcome HTTP 1.1 will be introduced to solve the drawbacks of these issues.

The issues in HTTP 1.0;

Only provide basic authentication which means for example usernames and passwords are unencrypted making them vulnerable to snooping, also they have no time dependencies. Therefore any information gathered by snooping can be used long after it was collected.

HTTP 1.0 was designed to use a new TCP connection for every request; therefore each request suffered the cost of setting up a new TCP connection.

Some version 1.0 implementations used a “keep-alive” header to request a connection to persist, it did not operate well with intermediate proxies.

For these reasons, HTTP 1.1 will be given the proper solution to solve HTTP 1.0 issues.

HTTP 1.1

HTTP 1.1 introduced 24 new status codes to better define errors and failures.

It gave Digest Access Authentication, which means for example that the response the client must compute a checksum (default MD5) of the username, password, one-time value, HTTP request method, and requested URI. The password is not only encrypted but the particular response is only valid for a single specific resource and method.

It can transmit multiple requests over a solitary TCP connection for each request is required to be sent in one continuous message.

version1.1 is becoming the de facto protocol with web server administrators.

Reference:

https://www.cloudflare.com/en-gb/learning/ddos/glossary/hypertext-transfer-protocol-http/

--

--

Arun prashanth
Arun prashanth

Written by Arun prashanth

Software Engineer at Virtusa (Pvt) Ltd.

No responses yet