Enter in the browser address bar to enter a URL, technical steps behind what would be

Reference know almost answered https://www.zhihu.com/question/34873227/answer/518086565, and Jane books https://www.jianshu.com/p/4fc2464db684 and CSDN blog https: //blog.csdn. net / wuhenliushui / article / details / 20038819 /

This is a classic problem was summed up by looking a little information about the process as follows:

  • Browser URL preliminary examination format, the default https protocol, such as input url to baidu.com, the browser will auto-complete as https://www.baidu.com/

  • DNS for URL address resolution , first looks for DNS Cache (cache memory) and host file (hard disk), and if so, resolve to complete the return IP ; if not, you need to find the DNS servers (8.8.8.8)

    • DNS will be sent to the DNS server by IP URL, IP routing first query to find the gateway's MAC address (ARP query), and then locate the DNS server via the Internet

    • DNS server after receiving the URL to find local cache, if not, then query the root name servers (global total of 13 units), and finally get the URL corresponding IP address and IP address to the DNS

  • After the IP address of the DNS to get the results back to the browser, and then via TCP / IP three-way handshake to establish a connection channel . The browser http requests sent to the TCP after the news package, and then sent to the server over IP.

    • Between browser process and TCP service program provided by the operating system, there is a very important thing called a socket (Socket), if a host likened to a house, the process compared to the rooms inside the house, Socket quite to the door of the room. TCP socket is a four-tuple (source IP address, source port number, destination IP address and destination port number) to identify the socket role is to be multiplexed, and the transport layer demultiplexer

    • Creating a TCP connection is a sign of success: client and server have created a source from the IP address, source port number, destination IP address and destination port number Socket logo

  • Server gets the request, parses the request message, and the processing and returns a response

    • web server software (as IIS and Apache) receives the HTTP request, and then determine what requests to perform processing to deal with it. It is capable of processing a read request and can generate an HTML request for a program in response (like ASP.NET, PHP, RUBY ...).
    • Processing read request and the request of its parameters and cookies. It will also be updated to read some data, and speak data stored on the server. Then, processing requirements will generate a HTML response.
  • The client parses the HTTP response message, the browser displays the HTML start

  • AJAX browser sends a request, even if the update page

    • "AJAX" - "Asynchronous JavaScript and XML", Facebook chat feature provides an interesting question about AJAX cases: data from the server side pushed to the client. Because HTTP is a request - response protocol, the chat server can not send a new message to the customer. Instead, every few seconds client has polled the server to see if they have no new messages.
Published 70 original articles · won praise 28 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_24852439/article/details/104075677