Load a page secret behind [Reserved]

 

Overall, divided into the following processes:

  • DNS resolution: The domain names into IP addresses
  • TCP connections: TCP three-way handshake
  • Send an HTTP request
  • HTTP server processes the request and returns the packets
  • Browser parses rendering pages
  • Disconnect: TCP four wave

 

A, URL in the end is what

URL (Uniform Resource Locator), uniform resource locator for positioning on Internet resources, commonly known as URLs.

For example,  HTTP: //www.w3school.com.cn/ht ... , subject to the following syntax rules:scheme://host.domain:port/path/filename

Explanations of each part:

  • scheme - type definition Internet services. Common protocols are http, https, ftp, file, of which the most common type is http, but https is encrypted network traffic.
  • host - the domain host (default host is http www)
  • domain - the definition of Internet domain names, such w3school.com.cn
  • port - the port number on the definition of the host (the default port number for http is 80)
  • path - the path is defined on the server (If omitted, the document must be in the root directory of the website).
  • filename - the name defined in the document / resources

 

Second, the domain name resolution (DNS)

Enter the URL in the browser, the first to go through the domain name resolution, because the browser does not find the corresponding domain name server directly, but through the IP address.

1. IP address

IP address is the Internet Protocol address, IP Address is the abbreviation. IP address is a uniform address format of the IP protocol provides, assign it a logical address for each network on the Internet and each host in order to mask the differences in the physical address. An IP address is a 32-bit binary number, such as 127.0.0.1 native IP.

IP address of the domain name is equivalent to disguise pretender dress, with a mask. Its role is to address a group of servers to facilitate memory and communication. Users typically use a host name or domain name to access each other's computer, rather than direct access by IP address. As compared with a group of pure digital IP addresses, with representation letters with numbers to specify the computer name more in line with human memory habits. But if you want the computer to understand the name, it becomes relatively difficult. Because computers are better at handling long string of numbers. In order to solve the above problems, DNS service came into being.

2. What is a Domain Name

DNS protocol provides domain name lookup by IP address, or reverse domain name from IP address reverse lookup service. DNS is a network server, our domain name resolution simply, a record information is recorded on the DNS.

3. How the browser to query the URL corresponding IP domain name through it

  • Browser Cache: The browser will cache DNS records according to a certain frequency.
  • Operating system cache: If the browser cache DNS records need not be found, then go find the operating system.
  • Routing cache: The router also has the DNS cache.
  • ISP's DNS server: ISP Internet service provider (Internet Service Provider) for short, ISP's DNS servers respond to a dedicated DNS queries.
  • Root Server: ISP's DNS server can not find it, it will send a request to a root server, recursive queries (DNS server to ask the root name server .com domain name server's IP address, and then ask .baidu domain name server, followed by analogy)

Browser by sending the DNS server, DNS server queries the domain name to the corresponding IP address, and then returned to the browser, the browser IP address and then hit the protocol, but the request parameters are also mounted on the agreement, and then together sent to the corresponding server. Next comes the stage sends an HTTP request, the HTTP request to the server is divided into three parts: TCP three-way handshake, HTTP request response information, closes the TCP connection.

 

Three, TCP three-way handshake

Before the client sends data initiates TCP three-way handshake for synchronization client and server serial number and confirmation number, and information exchange TCP window size.

1. TCP three-way handshake is as follows:

  • The client sends a belt SYN = 1, Seq = X data packet to the server port (the first handshake, initiated by the browser, I want to tell the server to send a request)
  • The server sends back a tape SYN = 1, ACK = X + 1, Seq = Y response packet to show convey confirmation message (second handshake, initiated by the server, I was ready to tell the browser to accept, and you quickly send it)
  • Client return pass with ACK = Y + 1, Seq = Z packets on behalf of a "handshake End" (third handshake, sent by the browser tells the server, I'll be made ready to accept it)

2. Why need three-way handshake

Xie Xiren the "Computer network" talk "three-way handshake" is to "have failed to prevent the connection request segment suddenly transferred to the server, resulting in an error."

 

Fourth, the HTTP request

 

Fifth, the server processes the request and returns an HTTP packets

 

Sixth, the browser parses rendering pages

Browser parses rendering the page is divided into about five steps:

  • The parsing HTML DOM tree
  • Parse tree is generated according to the rules of CSS CSS
  • Combined with the DOM tree and CSS rules tree, generated render tree
  • Calculating information of each node according to the render tree
  • According to the calculated information to draw page

 

Seven, disconnect

When the data transfer is completed, the need to disconnect the connection tcp, tcp four wave initiated at this time.

  • Initiating direction of the passive side of sending packets, Fin, Ack, Seq, said it had no data is transmitted. And enter FIN_WAIT_1 state. (The first wave: initiated by the browser, sent to the server, I request packet sent over, you are ready to close it)
  • Passive sends packets, Ack, Seq, agreed with the shutdown request. The host is the initiator into the FIN_WAIT_2 state. (Second wave: initiated by the server, telling the browser, I accepted the request packet is over, I am going to shut up, you prepare it)
  • Passive direction initiator sends segment, Fin, Ack, Seq, close the connection request. And enter LAST_ACK state. (Third Wave: initiated by the server tells the browser that I respond to messages sent over, you are ready to close it)
  • Initiating direction passive sends segment, Ack, Seq. TIME_WAIT then enters a wait state. Passive has received the originator of the message segment after closing the connection. Initiator wait for a certain time has not received a reply, then shut down gracefully. (Fourth wave: initiated by the browser tells the server, I accept the response packet is over, I am going to shut up, you prepare it)

 

 

 

Reprinted: https://blog.csdn.net/weixin_43063753/article/details/88306413

 

 

Guess you like

Origin www.cnblogs.com/fqfanqi/p/11111220.html