2.7.2. HTTP version

2.7.2.1. HHTTP

HTTP is an application layer protocol based on the TCP/IP protocol, which mainly specifies the communication format between the client and the server, and uses port 80 by default.

2.7.2.2. HTTP 0.9

HTTP 0.9 was first released in 1991. It only supports GET commands. The request format is only simple GET /url . The server only responds to HTML, and closes the TCP connection after the response.

2.7.2.3. HTTP 1.0

In May 1996, the HTTP/1.0 version was released, which enriched the format and content of transmission, and introduced two verbs, POST and HEAD. Since 1.0, the protocol version must be added at the end. In 1.0, status code, multi-character set support, multi-part type, authorization, cache, content encoding, etc. were also introduced.

The main disadvantage of HTTP version 1.0 is that only one request can be sent per TCP connection. After sending the data, the connection is closed. If you want to request other resources, you must create a new connection.

The cost of establishing a TCP connection is high, because the client and server need to shake hands three times, and the sending rate is slow at the beginning (slow start), so the performance of HTTP 1.0 version is relatively poor.

2.7.2.4. HTTP 1.1

In January 1997, the HTTP/1.1 version was released, which further improved the HTTP protocol. Version 1.1 mainly introduces persistent connection, pipeline mechanism, Content-Length, and block transfer encoding. The pipeline mechanism means that in the same TCP connection, the client can send multiple requests at the same time, which improves the efficiency of the HTTP protocol. Verb methods such as PUT, PATCH, HEAD, OPTIONS, and DELETE were also introduced in HTTP 1.1. In addition, version 1.1 added the Host field to specify the domain name of the server, which is the basis for the development of virtual hosts later.

Although version 1.1 allows multiplexing of TCP connections, within the same TCP connection, all data communication is performed in order. The server will only proceed to the next response after processing one response. If one request is slow, subsequent requests will be blocked.

2.7.2.5. SPDY

In 2009, Google disclosed its self-developed SPDY protocol to solve the inefficiency problem of HTTP/1.1, which was then used as the basis for HTTP/2.

2.7.2.6. HTTP/2

In 2015, HTTP/2 was released. HTTP/2 is a binary protocol. The header information and data body are both binary, which are collectively referred to as frames. Frames are divided into header information frames and data frames. HTTP/2 multiplexes TCP connections. In a connection, both the client and the browser can send multiple requests or responses at the same time, and there is no need to respond in sequence.