Type the URL in the address bar of your browser, hit enter after experiencing what?

As stated, this is a very common interview questions. This paper gives a simple answer reference.

A, DNS resolution
 
DNS resolution, namely domain name resolution, domain name resolution will be people friendly friendship pairs router's IP address.

For example, the host name www.test.com resolved to specific IP address 26.231.117.56

This parsing process is actually a DNS cache query, the query sequence is as follows

  • Browser cache : get before the browser caches DNS 2-30 minutes.
  • Operating system cache : Check the hosts file, the file contains a number of domain names and IP of previously visited Web site data. It's like a local database. If you find you can get directly to the IP address of the destination host.
  • Cache router : the router has its own DNS cache.
  • ISP server cache : go to your ISP DNS cache to investigate.
  • Root name server cache
  • Top-level domain server cache : This was not to be found, then you take a look at the URL you enter is what. . .

In the DNS query steps, found in any one location, it will immediately return, not to continue the investigation down.

 
Second, establish a TCP connection to
 
the browser step come in accordance with the IP address of the server, and the port number (HTTP default port number 80, if you do not fill in a port number, then the browser will default you access to port 80), and server to establish TCP connections ( three-way handshake )

 
Third, the browser sends an HTTP request
 

Browser to submit an HTTP request message requesting the appropriate resources, such as a page of the site to the server. General request method GET.

 
Fourth, the server receives the request, and in response
 

After the server receives the browser sent to the HTTP request, the browser will respond to the HTTP response message back to the browser, HTML web page document browser request is stored in the response message in the response body.

 
Fifth, the browser parses the HTML document
 

After the browser receives the response message server will respond to the body of the HTML document is extracted, after its resolution, rendering a series of operations. The final results will be presented to the user.

 
Sixth, the release of a TCP connection
 

This is roughly six steps above the carding process for a page request.

 
Supplement
 
if you want more detailed and in-depth understanding of this process, you can look at the "Computer networks: top-down approach": Historical Web page request of the sixth edition of Chapter VII of the section. This section's start from your computer is not yet connected to the Internet. . . . . .

Guess you like

Origin blog.csdn.net/u013568373/article/details/92729759