HTTP/2: How is it different from previous versions?
HTTP/2 is the second version of Hypertext Transfer Protocol (HTTP), which is being developed by the Internet Engineering Task Force. After HTTP1.1, released in 1999, this would be the first new version. Now you must be wondering: Why should I use it? How would it be better than the version I’ve been using? Why do I even care?
Well, ignorance is a bliss but knowing things that may protect you from being vulnerable to something is even more blissful. How is it better than previous versions? Here’s the answer to it:
- Latency reduction According to httpbis, the sub-organization of IETF respinsible for R&D of http/2, the introduction of header field compression and multiple concurrent messages on the same connection has greatly reduced perception of latency. In other words, the time lag between stimulation and response has greatly reduced and now your websites will load faster.
- Less prone to errors This version of http is more efficient to parse as it is binary. http/1.x was completely a textual protocol so it requires four different ways to parse a message, which is more prone to errors. on the other hand, binary protocol has only one code path. Thus, it is less annoying for web-developers.
- Server Push This feature is also known as “cache push”. As the name suggests, it allows the server to push cache into a client’s computer. This allows the resources to load faster. The idea here is that if a client asks for a resource X, the server may know that he’ll require a resource Y, so it will “push” it without asking and will be stored in cache until the client actually asks for it.
- Reset In previous versions, if you had to stop a HTTP message of certain content-length, you just couldn’t unless you disconnect the TCP connection. In HTTP/2 on the other hand, you would much rather just stop the message and start a new one using reset stream frame (RST_STREAM) which will thus prevent the bandwidth from being wasted without having to tear down the connection.