Home » Article » Learn about the HTTP communication process

Learn about the HTTP communication process

HTTP stands for Hypertext Transfer Protocol . It is the primary communication protocol between computers using the Internet.

HTTP is a kind of controller, governing everything that happens on the web. That’s why it’s so important for developers to understand how it works and what’s really going on behind the scenes. That is, to understand how information is sent and received on a daily basis.

That’s what we’ll cover in this post. Check it out!

What is HTTP?

HTTP is an application layer protocol, meaning it must be implemented in the software responsible for communication, such as europe cell phone number list browsers and web servers.

It will always work together with two other protocols:

  1. TCP (Transmission Control Protocol): responsible for the transfer of information;
  2. IP (Internet Protocol): responsible for data transmission, forming the well-known TCP/IP model.

This communication carried out via HTTP follows the request-response model. So, when you open your browser to access a website, you are requesting information from the server; the server, in turn, will receive the request, perform the appropriate internal processes, and return a response.

This response is usually HTML content, which will be interpreted by the browser, generating the content of the website being accessed.

After this process of browser request the final stage was the creation of a master template for the mailing and server response, the connection is terminated and the entire cycle must be repeated each time a new action is performed.

This means the connection isn’t persistent. With each access or update to the content, a new HTTP connection is created, and the entire cycle repeats.

It’s worth remembering that HTTP isn’t just used in the browser. It’s very present in mobile apps, for example, as most of them communicate with the back-end via this protocol.

But how does communication between client and server work in HTTP? It’s done in text format, following a well-defined pattern.

Next, we will show the structure of the request and response.

How is the request made to the server?

It all starts with the request made by the server. It consists of the following parts:

1 – Order line

It consists of 3 pieces of information:

  1. Method identifier, which is the type of action expected from the server. There are about eight different methods, but the most popular are “Get” and “Post”;
  2. Resource URL, the address to which the request will be sent, such as “/index.php”;
  3. Protocol version, there are country list currently 4 versions: HTTP 0.9, HTTP 1.0, HTTP 1.1 and HTTP 2. Of these, version 1.1 is the most widely adopted by systems.

2 – Header

This is where additional information for the request is passed. The server may respond differently, depending on the fields and values ​​it contains.

It can be divided into 3 groups:

  1. General heading;
  2. Request header;
  3. Entity header.

3 – Body or message

Contains the data from the request itself. In an HTML form submission, for example, the information would remain in the body. See this example request:

 

And the structure of the response, how does it work?

Once the request is made, it’s time to analyze the response the server can provide. Its format is also composed of three parts:

1 – Status line

It consists of 3 main pieces of information:

  • Protocol version, which, as in the request line, will report the version used on the server;
  • Numeric status code, which is the three-digit number that corresponds to how our request was conditioned on the server;
  • Text associated with the status.

The first digit of the status corresponds to the category to which it belongs. There are 5 categories in total.

Scroll to Top