Talk about client access a URL link of the whole process

Talk about is how to control the login rights

 

 

 

 

We can put this process into a process analogous telephone conversation. When we want to call someone, we must first know each other's phone number, then dial up.

After that we will open up the phone conversation, of course, dialogue certainly need a common language, if a person speak Mandarin, while the other person speak English, it is certainly not to communicate.

In the present embodiment, the telephone number of IP addresses corresponding to the above, the common language is equivalent to the HTTP protocol.

The following is a step of HTTP request / response:

1, the client connects to the Web server

An HTTP client, typically a browser, Web server with HTTP port (default is 80) to establish a TCP socket connection. For example, http: //www.oakcms.cn.

2, transmits an HTTP request

Sending a TCP socket text, client request message to the Web server, a request packet by the request line, request headers, blank lines, and 4 parts request data.

3, the server accepts the request and returns an HTTP response

Web server parses request, locate the requested resource. The copy of the resource server writes a TCP socket, read by the client-side. A response line from the state, in response to the head, and blank lines in response to data 4 parts.

4, connected to a TCP connection release

When the connection mode is close, the server closes the TCP connection, the client closes the connection passive release the TCP connection; if Keepalive connection mode, then the connection will be maintained for a period of time, you can continue to receive requests in the time;

5, the client browser parses the HTML content

The client browser status line resolved first, to see that the request is successful status code. Then parse each response header, the response header to inform the character set of HTML documents and document several bytes. The client browser reads the HTML response data, formatted according to its HTML syntax, and displayed in the browser window.

For example: Type the URL in the browser address bar, then press Enter to go through the following process:

1, the browser requests the URL to the DNS server to resolve the domain name corresponding to the IP address;

2, the IP address parsed TCP connection establishment according to the IP address and the default port 80, and the server;

3, the browser issues a read file (URL domain name corresponding to the rear portion of the file) of the HTTP request, the request packet as a TCP three-way handshake packets of the third data to the server;

4, the server responds to the browser request, and sends the html text corresponding to the browser;

5, releasing the TCP connection;

6, the browser displays the html and text content;  

Three times TCP handshake

 

 

Recorded four times TCP disconnection

 

 

 

https://www.processon.com/view/link/5d2afd9ee4b05dcb43a254a5

Servlet is the use of server-side program written in the Java language, which runs on a Web server Servlet container. Its main function is to provide a request / response model of the Web service, may generate dynamic Web content, FIG works as follows:

Reprinted from: https://www.cnblogs.com/qianjinyan/p/11159143.html 

Guess you like

Origin www.cnblogs.com/mrjade/p/12486961.html