HTTP/2 protocol is the second version of HTTP, a network protocol used to define the format and transmission of data. The HTTP/2 protocol was released by the Internet Engineering Task Force in 2015. HTTP and HTTP/2 are both application protocols commonly used over the internet. HTTP/2 is supported by web browsers such as Chrome, Firefox, Internet Explorer and Safari.
HTTP stands for Hypertext Transfer Protocol and is used for communication over the World Wide Web. HTTP is based on a client/server model where both client and server sides communicate through requests and responses.
HTTP/2 the first significant revision to HTTP since HTTP 1.1. HTTP/2 brings performance benefits over the original HTTP by focusing on improving end-user latency, resource and network usage. HTTP/2 also allows a single connection from a browser to a website.
Features of HTTP/2
HTTP/2 improves performance through implementing new features, including:
- A high-level of compatibility with HTTP 1.1- Sharing URIs, header fields and status codes.
- Request multiplexing- Which allows multiple data streams in one TCP connection, letting end-users load a website faster without any optimization.
- Server push- Which allows a server to send additional data to the client that is not initially requested. If an endpoint machine needs more data with a request, server push lets the server send that additional data the other machine can cache.
- Header compression- Which compresses redundant header frame. Using the HPACK specification, headers are compressed to individual values, sent to the server, then is reconstructed using a list of previously transferred header values.
- Binary protocol- Which uses binary for task executions instead of text commands—like in HTTP. This process simplifies the command implementations.
HTTP/1 vs HTTP/2
HTTP/2 focused on improving upon many of HTTP/1 and 1.1's limitations. HTTP/1 was only able to process one request in a TCP connection at a time, meaning multiple TCP connections would have to be used to process multiple requests at a time. This process may lead to TCP congestion. Data may also be duplicated in this process as well. Developers or IT admins would use domain sharding, data inlining and data spiriting, among other practices to get around this.
HTTP/2 improves on how data is transferred between a server and client. Request multiplexing, saves on congestion by allowing multiple data streams in one TCP connection, for example. Server push allows a server to push additional data the client may end up needing as well. HTTP/2 keeps some of HTTP/1s syntax including, status codes, URIs and methods. HTTP/2 has also dropped support for features HTTP/2 has replaced, such as HTTP/1s chunked transfer encoding.
Advantages and disadvantages of HTTP/2
Advantages of using HTT/2 include:
- New features add improvement of speed in page loads.
- New changes do not require developers to change how their past web applications work.
- No need for workarounds that HTTP1 or 1.1 used such as domain sharding.
- HTTP/2's use of binary instead of text commands for task execution.
- HTTP/2's use of multiplexing.
- Use of HPACK to condense headers.
- Server push features to clients.
Disadvantages that come with utilizing HTTP/ include:
- That only new applications can utilize HTTP/2.
- Encryption of data is not required. Encryption has been left as it is in HTTP/1.1.
- Cookie security has not been improved. HTTP/1, HTTP/1.1 and HTTP/2 have been left the same in terms of cookie security. .txt files on an HTTP request can contain data on the client. This data can be collected by the server and website. Advertisement providers can also use this data for targeted advertisements.