First, HTTP protocol:
1. What is HTTP protocol
The web address we entered in the browser's address bar is called the URL (uniformresourcelocator, Uniform Resource Locator). Just as every household has a home address, every page has an Internet address. When you enter a URL in the browser's address box or click on a hyperlink, the URL determines the address to be browsed. The browser uses the Hypertext Transfer Protocol (HTTP) to extract the Web page code from the site on the website and translate it into a beautiful web page. Therefore, before we know HTTP, it is necessary to understand the composition of the URL, such as: http://www.microsoft.com/china/index.htm. It has the following meanings:
http://: Represents a Hypertext Transfer protocol that notifies the Microsoft.com server to display Web pages, usually without input;
WWW: Represents a Web (WWW) server;
microsoft.com/: This is the name of the server that contains the Web page, or the site server;
china/: A subdirectory on the server, just like our folders;
Index.htm:index.htm is an HTML file (Web page) in a folder.
We know that the basic protocol of the Internet is the TCP/IP protocol, whereas at the top of the TCP/IP model is the application layer (Applicationlayer), which contains all the high-level protocols. High-level protocols include File Transfer Protocol FTP, e-mail Transport protocol SMTP, Domain Name System services DNS, Network News Transfer Protocol NNTP, and HTTP protocol. The HTTP protocol (hypertext Transfer Protocol, Hypertext Transfer Protocol) is a transfer protocol used to transfer hypertext from the WWW server to a local browser. It can make browsers more efficient and reduce network traffic. It not only ensures that the computer transmits the hypertext document correctly and quickly, but also determines which part of the document is transferred, and which part of the content is first displayed (such as text prior to graphics). This is why you see the Web page address in the browser as "http://".
2, HTTP working principle
Because the HTTP protocol is based on the request/response paradigm (the equivalent of a client/server). After a client establishes a connection to the server, it sends a request to the server in the form of a Uniform Resource Identifier (URL), protocol version number, followed by MIME information including the request modifier, client information, and possible content. After the server receives the request, it gives the response information in the form of a status line, including the protocol version number of the information, a successful or erroneous code, followed by MIME information including server information, entity information, and possible content.
Many HTTP traffic is initialized by a user agent and includes a request for resources on the source server. The simplest scenario might be to do so through a separate connection between the user agent and the server. On the Internet, HTTP traffic usually occurs on top of a TCP/IP connection. The default port is TCP80, but other ports are also available. But this does not bode well for the HTTP protocol to complete on the Internet or other protocols on other networks. HTTP only indicates a reliable transmission.