The difference between different versions of http

Preface: What are the current versions of http

HTTP(Hypertext Transfer Protocol, Hypertext Transfer Protocol) is an application layer protocol used to transmit hypermedia documents. Currently, the main versions used are HTTP 1.0, , HTTP 1.1and HTTP 2.

1. HTTP 1.0

This is the earliest version, using a short connection, it has many shortcomings.

  • Each request requires a TCP connection to be established with the server, and the connection is disconnected immediately after the request ends.
  • Request pipelining is not supported, and only one request can be sent at a time.
  • Data transfers are not compressed and may cause network congestion.
  • The header information of the message is too large, and HTTP 1.0the header format is ASCIIcode text format, and the corresponding header information needs to be transmitted every time a request is made. Even if there are duplicate header information, these information will be transmitted repeatedly, wasting bandwidth and time.

Summary: Long links and pipelined requests cannot be processed efficiently; the request header information is too large, which can easily lead to network delays and waste resources.

Two, HTTP 1.1

This version has made some optimizations for the shortcomings of version 1.0, mainly in the following aspects.

  • TCPSupports persistent connections, that is , multiple requests and responses can be sent on the connection between the client and the server without re-establishing the connection for each request.
  • Pipelining is supported, and TCPmultiple requests can be sent simultaneously on one connection without waiting for the response to return. This reduces latency and increases network throughput.
  • A new cache processing mechanism is introduced, which can reduce the pressure on the server and increase the data transmission rate. Use headers such as Cache-Controland ETagto control caching mechanisms and have finer control over caching.
  • A stricter authentication and password protection scheme is introduced to better protect resources and prevent them from being accessed illegally.
  • Supports multiple encoding formats and allows the server to compress data and decompress it on the client, reducing the amount and time of data transfers.

1.1The version 1.0 has made some optimizations for the version, but there are still many problems. There are mainly the following points.

  • HTTP 1.1It adopts a queue-style method to respond to requests. Only one request can be processed at the same time, and concurrent requests cannot be processed. This may cause congestion, resulting in the failure of the remaining requests to be transmitted, affecting speed and performance.
  • Without reducing the size of header information, the problem of version 1.0 still exists.
  • Depending on the TCP connection, there may be problems such as congestion control, packet delay, etc.
  • HTTP 1.1cookiesThe following SSLsecurity mechanisms are not perfect, and they will face problems such as information leakage, identity forgery, and cross-site scripting, which threaten network security.

3. HTTP 2

This version was released in 2015 and is now the most widely used version. It has been further optimized compared to version 1.1.

  • Multiplexing: HTTP 2.0multiple requests and responses can be transmitted at the same time, without the need to HTTP 1.xestablish multiple TCP connections like the version.
  • Binary framing: divide the message into smaller frames, each frame contains frame header information, these frames are transmitted out of order and processed in parallel, the frames do not affect each other, and the error rate is reduced by binary coding.
  • Header compression: In HTTP 2.0, clients and servers can maintain a static table and a dynamic table to store previously sent HTTP headers. These headers can be compressed for faster transmission over the network.
  • Server push: HTTP 2.0Allows the server to push data to the client in advance, and the client will receive resources from the server without an explicit request, which speeds up the loading of web pages.

HTTP 2 is good enough, but there are still some deficiencies, but these deficiencies can only be said to be the direction of future upgrades and optimizations, not fatal flaws.

  • New server and client support required: For older versions of browsers and servers, additional configuration and plugins are required to be compatible.
  • High overhead: due to the complexity of the algorithm used in header compression, higher computer resources are required.
  • Does not support stateless connection: HTTP 2.0Multiplexing is used to improve performance, but this also brings a problem, that is HTTP 1.x, HTTP 2.0the connection of , is more resource-intensive than , and cannot HTTP 1.xbe maintained as a stateless connection like .
  • Head-of-line blocking: In HTTP 2.0, multiple requests share a TCP connection, but in HTTP 2.0, responses need to be returned in the order of the requests. For a request that does not return, other requests of the current connection will be blocked. This phenomenon is called make Head-of-line blocking.

END

Guess you like

Origin blog.csdn.net/m0_53808238/article/details/130834570