HTTP protocol

In order to better understand the HTTP protocol, let’s take a brief look at the TCP/IP protocol family. Usually the network we use is based on the TCP/IP protocol family, and HTTP is no exception.TCP/IP protocol family

The client and the server communicate with each other, and both parties must follow the same rules, such as:1 How to detect the communication target2 Which side initiates the communication first3 Which language is used for communication4 How to end the communication5 Different hardware and operating system How to communicate

All this requires a certain constraint rules, we say the rule is the protocol .Layered management of TCP/IP

One of the most important features of the TCP/IP suite of protocols is layering. The TCP/IP protocol family is divided into the following four layers: the application layer, the transport layer, the network layer, and the data link layer (the OSI reference model is divided into seven layers).Application layer

Role: The application layer determines the activities of communication when providing application services to users. Eg. DNS, FTP, HTTP.2. Transport layer

Role: The transport layer provides the data transfer between the two computers in the network connection to the upper application layer. Eg. UDP, TCP.3. Network layer

Role: The network layer is used to process packets flowing over the network. A packet is the smallest unit of data transmitted by the network. This layer specifies the path to the other party’s computer and passes the packet to the other party.4. Link layer

Role: Used to handle the hardware part of the connected network. This includes physical controls such as control of the operating system, hardware device drivers, NICs, and fiber optics.Protocols that are closely related to HTTP: IP, TCP, and DNS

1. IP protocol responsible for transmission

According to the hierarchy, the IP is located at the network layer;the role of the IP protocol is to transmit various data packets to each other, and to ensure delivery to the other party, various conditions must be met, two important conditions being the IP address and MAC address. ;communication between the MAC address-dependent IP, ARP protocol employed to communicate with the MAC address.MAC (Media Access Control) address, also called hardware address. 

To put it bluntly, the MAC address is like the ID number on our ID card and is globally unique. We can assign an arbitrary IP address to a host as needed. Once any network device (such as a network card or router) is produced, its MAC address cannot be modified by the configuration in the local connection. If the network card of a computer is broken, the MAC address of the computer changes after the network card is replaced.

2. Ensure reliable TCP protocol

According to the hierarchical, TCP is located at the transport layer, providing a reliable byte stream service. Theso-called byte stream service means that, in order to facilitate transmission, the large block data is divided into packets in units of segments for management. 

A reliable transmission service means that data can be accurately and reliably transmitted to the other party.In a nutshell, the TCP protocol splits the data in order to make it easier to transfer big data, and the TCP protocol can confirm whether the data is sent to the other party.

3. DNS service responsible for domain name resolution

DNS is located at the application layer like the HTTP protocol, providing resolution services between domain names and IP addresses.

4. Relationship between various protocols and HTTP protocol

When sending a request, if the requested address is a domain name, the HTTP server first accesses the DNS server to obtain the IP address of the target server, and then generates an HTTP request message, which is sent to the TCP layer and transmitted to the target server according to the TCP/IP communication transport stream. .What is HTTP?

The HyperText Transfer Protocol (HTTP) is the most widely used network protocol on the Internet. It is the cornerstone of WWW (World Wide Web) to achieve data communication.It is an application layer protocol (the top level of the OSI seven-layer model) that delivers data (HTML files, image files, query results, etc.) based on the TCP/IP communication protocol.

The HTTP protocol is used for communication between the client and the server, and communication is achieved through the interaction of the request and the response (it is sure to establish communication from the client first, and the server will not send a response until it receives any request).

HTTP is a protocol that does not save state. In order to implement the desired state of saving state, cookie technology is introduced.

Protocol function

The HTTP protocol (HyperText Transfer Protocol) is a transport protocol for transmitting hypertext from a WWW server to a local browser. It can make the browser more efficient and reduce network transmission. 

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 displayed first (such as text before the graphic).The website address we enter in the address bar of the browser is called the URL (Uniform Resource Locator). 

Just like every household has a house address, each page also 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 browse. The browser extracts the webpage code of the site on the web server through the Hypertext Transfer Protocol (HTTP) and translates it into a beautiful webpage.working principle

An HTTP operation is called a transaction, and its working process can be divided into four steps:First the client and server need to establish a connection. Just click on a hyperlink and the work on HTTP begins.After the connection is established, the client sends a request to the server in the format of a Uniform Resource Identifier (URL), protocol version number, followed by MIME information including request modifiers, client information, and possible content.

After receiving the request, the server gives corresponding response information in the format of a status line, including the protocol version number of the information, a successful or erroneous code, followed by the MIME information including server information, entity information, and possible content.The information returned by the client receiving server is displayed on the user’s display through the browser, and then the client is disconnected from the server.

If an error occurs at a certain step in the above process, the error message will be returned to the client and output by the display. For the user, these processes are done by HTTP itself. The user just clicks with the mouse and waits for the information to be displayed.HTTP message

The information used for the HTTP protocol interaction is called an HTTP packet. The packet requested by the client is called a request packet. The packet that the server responds to is called a response packet. 

HTTP packets can be roughly divided into two parts: the packet header and the packet body. Both are divided by the initial blank line (CR+LF). Usually, there is no need to have a message body.

LEAVE A REPLY