HTTP, HTTP2, HTTPS

After a user enters a website address in the browser, a request is first formed, which is then sent through a network of routers to the DNS (Domain Name System) server, where the IP address of the target computer is obtained. Afterward, through the network of routers again, the request reaches the web server, which generates a response in the form of an HTML document and sends it back to the user's computer, where the browser reads it and displays the page.

Such interaction would be impossible without rules governing communication between the client and server. These rules are called protocols, and they describe the format of requests and responses. While there are many protocols on the internet, HTML documents are transmitted using HTTP (HyperText Transfer Protocol). HTML is a markup language for hypertext. Here's an example of adding protocol information by the web server:

GET /courses
HTTP/1.1 t.me/python312
Chrome/124.0.6367.119
IP 46.37.116.17        

Additionally, information about the protocol is added by the web server before sending the response:

HTTP/1.1 200 OK        

So, besides the webpage itself, the web server sends technical parameters, including protocol data. Essentially, the client and server agree on the rules they will communicate by, and these rules are described in the HTTP protocol version 1.1. The web server itself is often referred to as an HTTP server.

Here are some other peculiarities of the HTTP protocol:

Besides transferring HTML documents, HTTP is also responsible for all files associated with the document – styles, fonts, scripts, icons, images, etc. Each such element of the page will trigger its own separate HTTP request. So, to fetch an entire page, multiple requests are needed. Some requests will be executed in parallel by the browser to speed up loading, while others sequentially. Each HTTP request goes through a path from the client to the server and back. And each stage – network traversal, DNS table lookup, response generation on the web server – takes tens to hundreds of milliseconds, which, when compounded by a large number of elements on a page and sequential request sending, can take a considerable amount of time. This is a significant limitation of the HTTP protocol that heavily impacts page loading speed, and it's something that needs to be considered in web development. If possible, bundling many homogeneous files into one can help. This is commonly done with styles and small images. This approach reduces the number of HTTP requests and increases website performance. However, it's worth noting that these issues relate to HTTP protocol version 1.1.

HTTP/2, on the other hand, can automatically reduce the number of requests and handle data transmission between the client and server more efficiently, solving some of the problems mentioned above. But it's important to know which web server your site will be running on and whether it supports all versions of the HTTP protocol.

In addition to HTTP protocols, there is HTTPS, where the 'S' stands for secure. Security is an additional option and operates on top of HTTP protocols. The difference is that data is additionally encrypted. This allows for the seamless transmission of confidential information between the website and the browser. Hence, today, all popular websites that care about their users operate on the HTTPS protocol.

Finally, it's essential to understand the components of HTTP requests and responses and that different methods are supported for requests, while responses return different codes.

https://t.me/python312

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics