HTTP/2 is the latest version of the Hypertext Transfer Protocol (HTTP), a new protocol. It is used to transfer data, which will greatly speed up the network and can help with search engine optimization.
Development of HTTP
The first documented version of HTTP, HTTP 0.9, was released in 1991 , later the HTTP1.0 version was officially introduced in 1996, and the HTTP1.1 version was launched in 1997, with few improvements since then.
Then, in 2015, the HTTP/2 implementation specification was officially standardized in response to Google's HTTP-compatible SPDY protocol.
How does HTTP/2 work?
HTTP/2 provides significant speed improvements because lines can be kept open and large amounts of content can be sent at once.
Every time we click a link to access a site, a request is made to the server. The server replies with a status message (title) and a list of files for the site. After viewing the list, the browser requests files one at a time.
The difference between HTTP/2 and HTTP/1.1
1. The difference in data
HTTP/1.1 uses text data, which is generally less efficient on the web. And HTTP/2 is binary data.
2. The difference between headers
The header is the information sent with the request. It describes the data, its source, type, length, and how long it can be cached. wait.
HTTP/1.1's headers are not compressed, while HTTP/2's headers are compressed.
3. Order of response to requests
In HTTP/1.1, the server must send responses in the same order in which requests are received. However, HTTP/2 is asynchronous, it uses pipelining and therefore allows for faster processing and faster responses.
4. HTTP/2 is multiplexed
In HTTP/1.1, only one request can be processed on the TCP connection at any time. Browsers typically open between four and eight connections, but large or slow assets may cause download delays for other files. However, HTTP/2 allows multiple request and response messages to be sent simultaneously on the same (single) connection.
5. HTTP/2 implements server push
The server can send assets before requesting. In HTTP/1.1, the browser would download the HTML, parse it, and then load the JavaScript file when its <script> tag was encountered. </script>
However, HTTP/2 servers can push JavaScript files to the browser before they know they are needed.
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
The above is the detailed content of What does HTTP/2 mean?. For more information, please follow other related articles on the PHP Chinese website!