Difference HTTP0.9, HTTP1.0, HTTP1.1, HTTP2 of

HTTP0.9(1991)

This version is extremely simple, only a GET command

GET /index.html

The above command, said after the TCP connection (connection) is established, the client request to a server (request) page index.html.

Agreement, the server can only respond HTML-formatted string , can not respond to other formats.

<html>
       <body>Hello World</body>
</html>

The server sends finished, it closes the TCP connection


HTTP1.0(1996)

Content in any format can be sent. This makes the Internet can not only transfer the text, but also to transfer images, video, binary files. This laid the foundation for the development of the Internet

Each communication must include header information (HTTP header), is used to describe some metadata

In addition to the GET command, also introduced HEAD POST commands and command, rich interactive means browser and server

Other new features include a status code (status code), multi-character set support, multi-part send (multi-part type), permission (authorization), cache (cache), content encoding (content encoding), etc.


The main disadvantage of HTTP / 1.0 version, each TCP connection can send a request.

Sending data is completed, the connection is closed, even if the request for additional resources, it is necessary to re-create a new connection.

New TCP connection cost is high because it requires the client and server three-way handshake, and at the beginning of the transmission rate slow (slow start).

So, HTTP 1.0 version of the relatively poor performance.


HTTP/1.1(1997)

1, the introduction of persistent connections (persistent connection), i.e. does not close the TCP connection by default, multiple requests can be multiplexed without declaration Connection: keep-alive. Client and server activity not find each other for some time, you can take the initiative to close the connection. However, the standard practice is that the client at the time of the last request, send Connection: close, explicitly requires the server closes the TCP connection

2, the introduction of the pipe mechanism (PIPELINING), i.e. a TCP connection with which, the client may send multiple requests at the same time. This will further improve the efficiency of the HTTP protocol.

For example, the client requires two resource requests. Previous practice, in which a TCP connection with the first A request to send, and then wait for the server to respond, and then received a request issued B.

Pipeline mechanism is to allow the browser requests A and B also issued a request, but the server is still in the order, to respond to requests A, B after the completion of the request response.

3, will perform the role of Content-length field expansion, i.e. declare the data length of the current response (a TCP connection can now transmit multiple responses, bound there should be a mechanism to distinguish between the data packets which belongs to a response)

4, using the chunked transfer encoding, for some dynamic time-consuming operation, the server need to wait until the completion of all the operations, in order to transmit the data, obviously this is not efficient. A better approach is to generate a data, a transmission, a "stream mode" (Stream) substituted "cache mode" (Buffer)

5,1.1 version also adds a number of verbs methods: PUT, PATCH, HEAD, OPTIONS, DELETE.

Further, the header information of the new client requests the Host field, to specify the domain name server

[Shortage]
Although Version 1.1 allows multiplexing connection TCP, but which is connected with a TCP, all data communications are carried out in sequence. Server only processed a response before the next response. If the response is especially slow in front, behind there will be many requests waiting in line. This is known as "head of line blockage" (Head-of-line blocking ).

To avoid this problem, only two ways: one is to reduce the number of requests, while the second is more open persistent connection.

This led to a lot of web optimization techniques, such as merging scripts and stylesheets, the picture is embedded CSS code, domain fragment (domain sharding) and so on. If the HTTP protocol designed to be better, this extra work can be avoided.


HTTP/2.0(2015)

In simple terms, HTTP / 2 (Hypertext Transfer Protocol version 2, originally named HTTP2.0), is the second major version of the HTTP protocol.

HTTP / 2 is the HTTP protocol since in 1999 HTTP1.1 released the first update is mainly based on SPDY protocol.
HTTP2.0 is characterized by: in the case of not change the semantics of HTTP, methods, status code, and the URI header field, greatly improve the performance of the web.

What is the SPDY protocol

Just to introduce HTTP2.0 in leads to a noun - SPDY protocol, what it is it?

SPDY is the nickname Speedy sound, meaning "faster."

It is an application layer protocol developed by Google based on the TCP protocol.

The goal is to optimize the performance of HTTP protocol, through compression, multiplexing and priority technology to shorten page load time and increase security.

The core idea is to minimize the SPDY protocol TCP connections.

SPDY is not a substitute for the HTTP protocol, but enhancements to the HTTP protocol.

Guess you like

Origin www.cnblogs.com/kai-/p/12655493.html