http protocol works (Compact)

When the HTTP protocol for communication, the need for a client (i.e., the end-user) and server (i.e., Web server), before sending a request message to the Web server on the Web client, first through TCP / IP protocol Web client and the server establish a TCP / IP connection between

  1. Access enter the URL in your browser

  2. First DNS resolution

  3. The client browser port number (default 80) parsed from the access address (URL) in.

  4. Web browser to establish a TCP connection between the IP address and port number to resolve the Web server

  5. After the connection is established, the client sends a request message to the server, the request packet format: the uniform resource identifier (URL), protocol version number, the back is a MIME message includes a request modifiers, client information and possible content.

  6. Server upon request, to give the corresponding response information, the format of a status line comprising a protocol version number information, a success or error code back is a MIME information includes server information, entity information and possible content.

  7. The client receives the information returned by the server displayed by the browser on the user's display, then the client and server is disconnected.

HTTP / 1.0 each request need to establish a new TCP connection, the connection can not be reused. HTTP / 1.1 is a new request may be established in the last connection to send the request over TCP connection can be reused. The advantage is to reduce the overhead repeated TCP three-way handshake, and improve efficiency.

Note: In the same TCP connection, a new request must wait to receive a response, it can send the last request.

Guess you like

Origin www.cnblogs.com/joinbestgo/p/10963054.html