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 browsers overseas data and web servers.
It will always work together with two other protocols:
- TCP (Transmission Control Protocol): responsible for the transfer of information;
- IP (Internet Protocol): responsible for data transmission, forming the well-known TCP/IP model.
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 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.
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 fundamentals of business psychology by the server. It consists of the following parts:
1 – Order line
It consists of 3 pieces of information:
- Protocol version, there are 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
The server may respond differently, depending on the fields and values it contains.
It can be divided into 3 groups:
- General heading;
- Request header;
- Entity header.
Most fields are self-explanatory, and some of the most common ones are:
- Date, which tells you the date of the request;
- Cache-Control, which sends fax list directives to the cache mechanism;
- Transfer-Encoding, specifies how to decode the request body;
- Cookie, sends information about cookies;
- Accept, which specifies the response preference;
- User-Agent, sends information about the browser.
And the structure of the respons
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.
- 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: