What process do you go through when you enter a URL in your browser?

1: Description of related concepts:

 1.1: DNS (Domain name System) cache: (Domain Name System) (see ipconfig/displaydns of this machine)

After the computer parses a domain name, it associates this domain name with the host IP address. The computer stores this relationship in the DNS cache table. The next time the computer enters www.baidu.com, the computer will pass By looking up the DNS cache, you can know the IP address corresponding to this domain name, and no longer perform domain name resolution, which improves efficiency

 1.2: ip address:

     The ip address corresponds to the house number, we can find the location of the host through this address

1.3: Domain name: (domain name):

The IP address is 4 numbers separated by commas. This thing is hard to remember. We generally use letters with numbers, such as .www.baidu.com., IP addresses and domain names are not one-to-one correspondence, a domain name can Bind multiple IPs, but a domain name can only be resolved to one IP address at the same time (this is done by our DNS for us)

Two: The general process of related requests

1: The browser resolves the IP address according to the domain name

2: The browser performs Socket communication according to the IP address

3: The browser communicates with the client, the browser requests, and the server receives the request

4: Browser and server disconnect

Three: the specific process

3.1: Finding Process

    1: The browser first looks up from its own DNS table to see if there is .www.baidu.com (corresponding IP address)

    2: Look up from the DNS table in the operating system (a table that maintains the correspondence between domain names and ip addresses)

    3: Find from the operating system host folder

    4: The operating system sends the domain name to the LDNS (local area domain name system). For example, if I am in Polytechnic University, then the LDNS server is in our school, and the DNS cache is searched. If it continues to fail, an iterative DNS resolution request is sent.
4.1: LDNS sends the Root name server (root domain name server, the domain that stores each domain name), Root name Server returns the top-level domain name server address of the com domain
4.2: LDNS sends a request to the com top-level domain name server, and returns the address of the www.bai.com domain name server
4.3: LDNS sends a request to the com top-level domain name server The www.baidu.com domain name server sends a request to get the ip address of www.baidu.com

  5: LDNS gets the IP address and returns it to the operating system, and caches the IP address in the DNS table

  6: The operating system returns the address to the browser. It also caches the IP address

  7: Now the browser has got the IP address

3.2: Establish a connection (three-way handshake) (using TCP protocol)

   Knowing Baidu's Ip address, the next step is to realize the connection of the three-way handshake

  1: The client sends a connection request to the server (Hello, nice to meet you)

  2: After receiving the request, the server sends a request to agree to the connection (OK, nice to meet you)

  3: After the client receives the server's consent request, it sends a confirmation signal to the server again (I am also very happy to meet you), and the connection between the host and the server is established since then.

3.3: Web page request and display

   After the connection is established, the communication between the server and the client will take place

 3.1: The client browser generates an Http request based on the IP address, the request contains the location of the file, and the request method

 3.2: The server receives the content of the http request and decides how to obtain the corresponding HTML file

 3.3: The server sends the corresponding HTML file to the browser

 3.4: When the browser has not fully received the HTML file, it starts to render and display the web page

 3.5: According to the html code, continue to request pictures,

3.4: Disconnection process (four times of waving process)

1: The client sends a disconnected request to the server (it's getting late, I should go)

2: The server receives a signal requesting to send a confirmation request (understood)

3: The server sends a disconnect notification to the client (I should go too)

4: The client receives the disconnection notification and feeds back a signal (OK), and the server receives the feedback signal to disconnect the link

The original text comes from: https://www.linuxprobe.com/url-process-experience.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325316743&siteId=291194637