Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Network knowledge & http Protocol

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Common protocols in each layer of the seven-layer model of the network:

Common http protocols work at the application layer

The working layer of http protocol:

The HTTP protocol is usually carried on the TCP protocol, and sometimes on the TLS or SSL protocol layer. At this time, it becomes what we often call HTTPS. See the following figure:

Workflow for the http protocol:

A HTTP operation is called a transaction, and its working process can be divided into four steps:

1) first, a connection needs to be established between the client and the server. Just click on a hyperlink and HTTP's work begins.

2) after the connection is established, the client sends a request to the server in the format of uniform Resource Identifier (URL), protocol version number, followed by MIME information including request modifiers, client information and possible content.

3) after receiving the request, the server gives the corresponding response information in the format of a status line, including the protocol version number of the information, a success or error code, followed by MIME information, including server information, entity information and possible content.

4) the information returned by the client receiving server is displayed on the user's screen through the browser, and then the client is disconnected from the server.

If an error occurs at one of the above steps, the information that produced the error will be returned to the client with a display output. For users, these processes are done by HTTP himself, and users only need to click with the mouse and wait for the information to be displayed.

TCP/IP

TCP is responsible for the communication between applications (such as your browser) and web software. IP is responsible for communication between computers. TCP is responsible for dividing the data and loading it into IP packets, and IP is responsible for sending the packets to the recipient. During the transmission process, the IP router is responsible for correctly addressing according to traffic, errors in the network, or other parameters, and then reassembling them when they arrive.

The whole process of a HTTP operation is explained in detail:

1) address resolution, such as using the client browser to request this page: http://localhost.com:8080/index.htm decomposes the protocol name, hostname, port, object path and other parts. For our address, the result is as follows: protocol name: http hostname: localhost.com port: 8080 object path: / index.htm in this step The domain name system DNS is required to resolve the domain name localhost.com to get the IP address of the host. 2) encapsulate the HTTP request packet to encapsulate the above part into a HTTP request packet combined with the local information. 3) encapsulate the TCP packet and establish a TCP connection (TCP's three-way handshake) before the HTTP work starts, the client (Web browser) first establishes a connection with the server through the network, which is done through TCP, which together with the IP protocol builds Internet, the famous TCP/IP protocol suite. Therefore, Internet is also called TCP/IP network. HTTP is a higher-level application layer protocol than TCP. According to the rules, only after the establishment of the lower-layer protocol can the connection of the higher-layer protocol be carried out. Therefore, the TCP connection should be established first. The port number of the TCP connection is 80. This is port 8080 4) after the client sends a request command to establish a connection, the client sends a request to the server in the format of uniform Resource Identifier (URL), protocol version number, followed by MIME information including request modifiers, client information, and content. 5) the server responds to the request and gives the corresponding response information in the format of a status line, including the protocol version number of the information, a success or error code, followed by MIME information, including server information, entity information and possible content. The entity message is that after the server sends the header message to the browser, it sends a blank line to indicate that the sending of the header information ends here. Then, it sends the actual data requested by the user in the format described by the Content-Type response header message. 6) the server closes the TCP connection. In general, once the Web server sends the request data to the browser, it closes the TCP connection. Then if the browser or server adds this line of code Connection:keep-alive to its header information

The TCP connection will remain open after it is sent, so the browser can continue to send requests over the same connection. Staying connected saves the time it takes to establish a new connection for each request and saves network bandwidth.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report