Browser access to the server process

1, the domain name on the browser input, for example www.baidu.com

2, the browser will first access the DNS server, the domain names into ip address, return to the browser

2) resolve how DNS works:

Principle steps:

1) the system will first look for the local hosts file and DNS cache information to confirm whether there and, www.baidu.com domain name corresponding to the IP address. If so, direct access www.baidu.com domain name server IP address corresponds.

2) If not found, then the system will parse the browser requests to the local host specified DNS server, called LDNS. If you have a domain name www.baidu.com corresponding IP address LDNS server to the client's browser is returned, if not, continue to request other DNS servers.

3) LDNS server (.) DNS resolution www.baidu.com start request from the root of the DNS system. DNS root servers worldwide only 13 units, is not the root name servers to resolve domain name www.baidu.com records. But it will have top-level domains .com domain name resolution records of www.baidu.com corresponding, therefore directly to the corresponding top-level domains .com DNS server address to the LDNS.

After 4) LDNS server obtains the DNS server address corresponding to the .com top-level domain, it will go to the server requesting resolution www.baidu.com .com domain names. In the top-level domain name server will not be resolved www.baidu.com record. But it has www.baidu.com resolution records of the parent domain, that baidu.com. Therefore .com top-level domain servers and will baidu.com corresponding to the DNS server's IP address back to LDNS.

After 5) LDNS baidu.com server receives the corresponding IP address, the request will go to the domain name server for baidu.com www.baidu.com analysis. Baidu.com domain name corresponding to the domain name's DNS server is authoritative DNS server. The DNS server is used to manage to resolve when companies buy the domain name server.

6) baidu.com domain DNS server, right www.baidu.com domain name corresponding to the IP address to resolve it, and send it LDNS.

7) LDNS the parsed result, www.baudu.com corresponding IP address sent to the client browser. And it will also be LDNS corresponding domain names and addresses into the cache buffer.

8) After receipt of the client browser, it will also be the domain name and corresponding IP addresses to DNS cache and cache hosts file.

3, the browser resolves the port number from the ip

4, establish a web browser to the server via ip and port number after the parsed a TCP channel connection (three-way handshake)

2, introduction and three TCP / IP protocol handshake and four wave

What 1) talk about the TCP / IP protocol is

Transmission Control Protocol / Internet Protocol shorthand, the translation of the Transmission Control Protocol / Internet Protocol, also known as network communication protocol, is the most basic Internet protocols, basic Internet Internet by the IP protocol and transport layer network layer TCP protocol components. TCP / IP defines how an electronic device connected to the Internet, and how the standard data transfer therebetween. Protocol uses a hierarchical structure of four layers, each layer protocol call its lower layer provided to complete their needs. Popular terms: TCP transport is responsible for discovering the problem, there is a problem signals, requiring re-transmission until all data is safely and correctly delivered to the destination. The IP is to networking equipment requirements of each Internet address.

5, after the TCP connection is established, the browser sends a HTTP request to the web server packets.

1) Request line

Role: to illustrate what the client wants to do.

Content: GET fields and methods, including URL field and the HTTP protocol version

2) request header

Role: the relevant information through a client request to the server

Content: including media type, language types, support for compression, client type, the host and other information.

3) blank line

Role: blank line tells the server does not belong to the following request header information.

4) request message body

Role: to explain what specific client wants to do.

Content: View information, applications post method.

6, web server responds to the request and reads information about the browser, and returns a HTTP response packet.

1) Status line

Effect: for explaining the server response status of the client.

Content: laundry and version number, digital state code, state case

2) response header

Role: The server the information about the response to the client

Contents include: Location, server, connect, vary, etc.

3) blank line

Role: tell the client does not belong to the blank line following response headers.

4) response packet body

Action: to load the data to be returned to the client

Content: including text, html, video or pictures.

7, web server closes the HTTP connection closes the TCP connection, web server to display Web content accessible to the screen.

Guess you like

Origin www.cnblogs.com/hualingyun/p/11018297.html