HTTP/2 Binary protocol

HTTP/2 provides an optimized transport for HTTP semantics. HTTP/2 supports all of the core features of HTTP/1.1 but aims to be more efficient in several ways.

What is HTTP/2

It was derived from the earlier experimental SPDY protocol, originally developed by Google. HTTP/2 was developed by the Hypertext Transfer Protocol working group httpbis (where bis means "second") of the Internet Engineering Task Force. The HTTP/2 specification was published as RFC 7540 in May 2015.

HTTP/2 is binary to make the framing much easier. Figuring out the start and the end of frames is one of the really complicated things in HTTP 1.1 and, actually, in text-based protocols in general. By moving away from optional white space and different ways to write the same thing, implementation becomes simpler.

HTTP/2 deals with:
  • Create a negotiation mechanism that allows clients and servers to elect to use HTTP 1.1, 2.0, or potentially other non-HTTP protocols.
  • Maintain high-level compatibility with HTTP 1.1 (for example with methods, status codes, URIs, and most header fields).
  • Decrease latency to improve page load speed in web browsers by considering:
    1. Data compression of HTTP headers
    2. HTTP/2 Server Push
    3. Pipelining of requests
    4. Fixing the head-of-line blocking problem in HTTP 1.x
    5. Multiplexing multiple requests over a single TCP connection
  • Support common existing use cases of HTTP, such as desktop web browsers, mobile web browsers, web APIs, web servers at various scales, proxy servers, reverse proxy servers, firewalls, and content delivery networks.

A single HTTP/2 connection can contain multiple concurrently-open streams, with either endpoint interleaving frames from multiple streams. Streams can be established and used unilaterally or shared by either the client or server and they can be closed by either endpoints. Multiplexing the streams means that packages from many streams are mixed over the same connection.

HTTP/2 reduces the number of necessary network round-trips and it avoids the head of line blocking dilemma completely with multiplexing and fast discarding of unwanted streams.

HTTP/2 is defined for both HTTP URIs (i.e. without encryption) and for HTTPS URIs (over TLS using ALPN extension where TLS 1.2 or newer is required).