HTTP and everything you need to know about it

HTTP stands for Hypertext Transfer Protocol, and it is the web-browsing communication protocol. This protocol follows a message-based architecture, in which your client sends an HTTP request to a web server, and the server responds with a resource that the browser displays.

A request and a response are included in every HTTP exchange. HTTP is stateless by definition.
Because every requests are distinct from one another and must contain enough information to fulfil the request on their own, stateless means that each request must contain enough information to accomplish the request. That is, each transaction in the HTTP message-based architecture is executed independently of the others.


The URL (Uniform Resource Locator) is the most well-known Web notion. It’s also one of the most important and practical topic. A URL is a web address that is used to locate resources on the internet.
The web’s concept is based on resources; from its inception, the Web has served as a platform for sharing text/HTML files, documents, and photos, among other things, and as such it may be regarded a collection of resources.


HTTP is the most common protocol (or HTTPS for a secure version of HTTP).
Other noteworthy procedures include:
FTP (File Transfer Protocol) is a standard protocol for transferring files over a network between a client and a server.
The Simple Mail Transfer Protocol (SMTP) is an email transmission standard.
Domain – A name that identifies one or more IP addresses where a resource can be found.
Path — Indicates the location of the resource on the server. It follows the same logic as a resource location on the device you’re using to read this page (for example, /search/cars/VWBeetle.pdf or C:/my cars/VWBeetle.pdf).
Parameters — Additional information used to identify or filter a server resource.


You may come across the phrase URI when looking for articles and additional information about HTTP (or uniform resource identifier). URI is occasionally used in place of URL, but only in formal specifications and by persons who want to brag:)
Requests made through HTTP
Every HTTP request must include a URL address. A method is also required for a request. The four most common HTTP methods are as follows:
In the HTTP Methods portion of this article, I’ll go over these and other methods.

And these acts are directly related to these methods:
read \update \create \delete
One or more headers are present in every HTTP communications, which are followed by an optional message body. The data that will be sent with the request or the data that will be returned with the response is contained in the body.
Three elements are included in the first half of every HTTP request:
GET /adds/search-result?item=vw+beetle  HTTP/1.1
A “?” symbol in a URL indicates that it contains an inquiry. That is, it sends the requested resource’s parameters.

The first section is a method that specifies the HTTP method to be utilised. The GET method is the most often utilised. The GET method receives a resource from the web server, and as it lacks a message body, nothing is required after the header.
The second part is a URL that has been requested.
The third component is an HTTP version. The most popular version for most browsers is version 1.1, but version 2.0 is rapidly gaining ground.
In an HTTP request, there are a few additional noteworthy things to look for:
Referer header – identifies the URL from which the request came.
Additional information about the browser that generated the request is contained in the User-Agent header.

When numerous web pages are hosted on the same server, a host header is required to uniquely identify the host name.
Additional parameters are sent to the client via the cookie header.
HTTP response
HTTP response have the same three components as HTTP requests:
HTTP/1.1 200 OK, for example
The first section is the HTTP version that is being used.
The second portion is the numeric code for the request’s result.
The third section is a textual description of the previous section.
There are a few other things to look for in an HTTP response:
Information about the web server software that is being utilised in the server header.
The Set-Cookie header tells the browser to send the cookie.
Message body — A message body is a common part of an HTTP response.

The Content-Length header specifies the message body size in bytes.

Methods of HTTP

The most popular methods are GET and POST, although there are more.
GET — used to request data from a specific resource without altering the data in any manner because GET requests do not change the resource’s state.
POST — used to build a resource by sending data to a server.
PUT — technique for updating an existing resource on a server with the content of the request body.
HEAD — This method performs the same function as the GET method, with the exception that the HEAD method’s response should not include the body. The response, however, will have the same headers as if GET was used.

TRACE – technique designed for diagnostic reasons. The body of the response will contain the identical content of the request message.
OPTIONS — this method is used to specify the target resource’s available communication options (HTTP methods).
PATCH — To make partial changes to a resource, use the PATCH technique.
DELETE — The DELETE method removes a resource from the system.


REST (representational state transfer) is an architectural style in which requests and answers include representations of the current state of a system’s resource.
The “usual” method is as follows:
REST-style: (representational state transfer) is an architectural style in which requests and answers include representations of the current state of a system’s resource.
The “usual” method is as follows:

HTTP Headers

The request/response structure is made up of three primary components. This includes the following:
First line
We’ve already discussed the first line in HTTP requests and responses, as well as the body function, and now we’ll discuss HTTP headers.
After the first line, the HTTP headers are defined as name: value pairs separated by a colon. Additional parameters are sent with the request or response using HTTP headers.
The body of the message, as previously stated, contains the data to be sent with the request or the data received with the answer.

We categories different sorts of headers into four general groups based on their use:
Headers that can be used in both requests and responses and are not dependent on the data being transmitted are known as general headers.
Request Header-These headers define parameters for the data sought or parameters that provide vital information about the client making the request.
Response headers — Information about the incoming response is contained in these headers.
Entity headers — Entity headers explain the stuff that makes up the message’s body.


Status codes on the HTTP protocol

The first line of every HTTP response message must contain an HTTP status code, which indicates the request’s outcome.
The initial digit of the status codes divides them into five groups:
1xx — For informational purposes only.
2xx — The request was approved.
3xx – The client gets sent to another page.
4xx — An error has occurred in the request.
5xx — The request was not fulfilled because the server encountered an issue.

HTTPS (Hypertext Transfer Protocol Secure)

HyperText Transfer Protocol Secure is a secure variant of the HTTP protocol (HTTPS). HTTPS encrypts data transmission between a browser (client) and a website (server).
Transport Layer Security (TLS) or Secure Sockets Layer (SSL) encrypts the communication protocol in HTTPS (SSL).
As a result, the protocol is sometimes known as HTTP over TLS or HTTP over SSL.
Asymmetric encryption is used in both the TLS and SSL protocols. To encrypt a message, an asymmetric encryption system utilises a public key (encryption key) and a private key (decryption key). The public key can be used to encrypt a message by anyone. Private keys, on the other hand, are kept secret, which means that only the intended recipient can decrypt the communication.




Leave a Reply

Your email address will not be published. Required fields are marked *