HTTP protocol request process

HTTP protocol request Process Analysis

Step: user input URL, to for example, after obtaining a host name, a DNS domain name resolution,

First, the browser itself will find your cache, if not, look for the hosts file of the machine, the machine after the hosts did not look native domain cache server, if it is not found in the cache server, the cache server and as a root domain initiated the request, root .com domain will return the IP address, and then the cache server requests .com server, the server returns .com IP address (assuming, the cache server will then look for server, asking www host IP address corresponding to the server will return IP address, and port number obtained in accordance with the URL, the default 80 ,.

After obtaining the IP address and port number, the client opens a random port (1024-65535) and its server ( is connected to port 80, to establish a TCP three-way handshake: First, the client sends a request to the server SYN packet, the SYN value of 1, the initial sequence number of x, in this case, the client in the SYN-SENT (server response wait state), returns an ACK packet after the server receives the acknowledgment, ACK value of 1, the sequence was confirmed number x + 1, at the same time, transmits a connection request SYN packet, SYN a value of 1, the initial sequence number y + 1, this time the server is SYN-RCVD (request acknowledgment status server), the client receives a confirmation number after x + 1, it sends an ACK packet, the ACK is 1, confirmation sequence number y + 1, this point, the client and server complete the TCP three-way handshake;

Then the client sends a HTTP GET request to the server, then the client from the server reads the corresponding HTTP, then the browser parses the HTML code, the HTML code and a resource request, the browser presents the content to the user;

When the user access is complete, the client will automatically disconnects the TCP starts four wave: the client sends a FIN packet is disconnected, the FIN is 1, the initial sequence number of u, then the client waits in a suspended state (FIN-wAIT-1), the server receives, a client will send a release acknowledgment packet ACK, ACK is 1, confirmation sequence number u + 1, while transmitting its own sequence No. v, after the acknowledgment packet after receipt of the client, enter FIN-wAIT-2 (suspended wait state 2) server in CLOSE-wAIT (wait closed state), but then the server can continue to want to send data server, the client passively accepted, the server will issue a FIN packet abort the connection, the FIN is an initial sequence number as w, in this case the service lAST-ACK (acknowledgment final state), the client receives a return acknowledgment packet ACK , acknowledge sequence number w + 1, the server receives disconnects own connection, but then the client is still in the tIME-wAIT (wait state), waiting 2MSL length (i.e. twice the maximum packet lifetime) after the end of the wait, The client will enter CLOSED state, bringing the four TCP waving completed, the client and the server breaks the TCP connection;

So far, HTTP protocol analysis request process ends

Guess you like