After entering the URL in the browser, it will perform the following processes: Perform DNS domain name resolution; Encapsulate HTTP request data packets; Encapsulate TCP request data packets; Establish a TCP connection (3-way handshake); Parameters are passed from the client to the server; After receiving the client parameters, the server performs corresponding business processing, encapsulates the results into HTTP packets, and returns them to the client. The interaction between the server and the client is completed, and the TCP connection is disconnected (4 waves); The browser uses its own execution engine to render and display the final result to the user. 1. DNS domain name resolutionLocation in the network relies on IP for identity location, so the first step of URL access is to get the IP address of the server. To get the IP address of the server, you need to use DNS (Domain Name System) domain name resolution, which is to find the corresponding IP address through the URL. PS: Why not directly access the IP address to request the server? Because IP addresses are long and inconvenient to remember, while URL addresses are much easier to remember, so URLs are used to replace IP addresses. URLs are like aliases of IP addresses, and can be used to locate the corresponding IP addresses. The general process of DNS domain name resolution is as follows:
2. Encapsulate HTTP request data packetsAn HTTP request object contains 4 parts:
Its basic format is as follows: After obtaining the server IP, the local request will be encapsulated into an HTTP data packet, as shown in the figure above. 3. Encapsulate TCP request data packetThe underlying HTTP layer is implemented based on the TCP/IP protocol, so during the underlying data transmission, the HTTP request packet will be further encapsulated into a TCP data packet. 4. Establish a TCP connection (3-way handshake)The basis of HTTP communication is TCP connection. TCP connection requires three handshakes. The three handshakes are to verify the sending and receiving capabilities of the client and the sending and receiving capabilities of the server. Just like a phone call, a normal call starts like this:
After the above three handshakes, the sending and receiving capabilities of the client and the sending and receiving capabilities of the server can be proved, so that communication can officially begin. 5. The server obtains the HTTP request parametersAfter the data is transmitted to the server program through TCP, the TCP data packet will be converted into HTTP data packet (all this is thanks to the TCP/IP protocol), so that the server can get the request data sent by the client. 6. The server performs business processing and returns dataAfter the server receives the request parameters from the client, it will perform the corresponding business processing. After the processing is completed, it will return the processing results to the client. The return process is similar to the sending process. The result is first encapsulated into an HTTP data packet. The HTTP data packet can be divided into the following 4 parts:
Its basic format is as follows: The status line is used to describe the return status of the server. It consists of 3 parts:
The common status codes are as follows:
The response body is all the data returned to the client. 7. Disconnect TCP connection (4 waves)After one request and one response, the "communication" between the client and the server ends, and the TCP disconnection process can be executed, which requires 4 waves:
After the above process, the TCP connection is disconnected. 8. The browser renders and displays the resultsAfter TCP interaction, the client also receives the data returned by the server, and then uses the browser's own execution engine to display the final result to the user, and the entire execution process is completed. References & Acknowledgementszhuanlan.zhihu.com/p/58108010 |
>>: How does SpringBoot ensure interface security? This is how veterans do it!
The China Internet Network Information Center (CN...
1. Introduction to QinQ The VLAN ID field defined...
Preface I have recently become interested in 5G n...
Let's learn about HTTPS. First, let me ask yo...
At the beginning of the year, the blog shared inf...
On August 11, according to foreign media reports,...
Launchvps recently launched two special annual pa...
Nowadays, the number of 5G package users and 5G m...
A few years ago, LET often carried out voting act...
Wireless routers have become an indispensable net...
AkkoCloud is a Chinese VPS service provider estab...
As we all know, mobile data traffic is growing ex...
Megalayer has released its regular promotion for ...
Recently, Cisco announced the launch of a new IT ...
[[386495]] This article is reprinted from the WeC...