History of HTTP and HTTP/2 Vs HTTP/1.1

saurav omar
4 min readNov 19, 2019

What is Http?

The Hypertext Transfer Protocol, or HTTP, invented by Tim Berners-Lee in 1989. It is an application protocol that has been the de facto standard for communication on the World Wide Web since its invention.

  • To allow communication between a server and a client. It is this communication that forms the basis of the Internet.

Different Versions of Http:

There are four versions that were released for HTTP.

HTTP/0.9: — The One-line Protocol

  • the first document version of HTTP invented in 1991.
  • I a simple client-server, request-response.
  • Request nature: single-line (method + path for requested document)
  • Methods supported: GET only
  • Response type: hypertext only
  • Connection nature: terminated immediately after the response
  • No HTTP headers (cannot transfer other content type files)
  • No status/error codes, No URLs, No versioning

HTTP/1: — Building extensibility

  • Released in 1996
  • Methods supported: GET , HEAD , POST
  • Provided header fields like Status , Content-Type ,HTTP Version Number.
  • Connection nature: terminated immediately after the response

HTTP/1.1 :— The standardized protocol

  • Released in 1997
  • Commonly used version.
  • Methods supported: GET , HEAD , POST , PUT , DELETE , TRACE , OPTIONS
  • cache support.
  • chunked transfers,
  • Connection nature: long-lived

HTTP/2.0 :— Spdy

We have seen all the released versions of HTTP. Let’s see the features of HTTP/2.0 which are not in HTTP/1.1

HTTP1.1 VS HTTP2.0:

Request Multiplexing:

  • With HTTP/1.1 we have to do multiple requests for different resources.
  • With HTTP/2 can send multiple requests for data in parallel over a single TCP connection
  • HTTP/2 allows you to download web files asynchronously from one server.
  • Multiplexing resolves the head-of-line blocking issue in HTTP/1.1 by ensuring that no message has to wait for another to finish.
  • Http2 is faster as well as uses less network bandwidth.

Stream Prioritization:

  • When website requests data (like CSS, HTML, Images, Javascript) from the server it should be in proper sequence, it should not be browser render HTML first but CSS has been requested.
  • In HTTP/1.1, this was easy, as head-of-line blocking made it simple to load various assets in the correct order.
  • In HTTP/2, this was solved using priority sends in the request (so need to multiple calls) based on the priority you will receive a response in corresponding order.

Binary Protocol:

  • HTTP1.x uses text-based commands to send and receive from the server complete HTTP requests. These requests are perfectly readable like the below diagram we are hitting google.com. you can read URL, request, etc.
  • HTTP2.0 uses Binary Protocol, Within this connection, there are multiple streams of data. Finally, each of the messages split into smaller units called frames(see below). All these frames are encoded in binary format(1 or 0). To achieve the same thing in HTTP1.x we have to do multiple calls.

Benefits:

  • Enhanced encoding mechanism.
  • Efficient to parse.
  • Faster over the network.
  • More secure.

Server push:

  • With HTTP/2 server to send additional cacheable information to the client that isn’t requested but is anticipated in future requests.
  • The process begins when the server sends a PUSH_PROMISE frame to inform the client that it is going to push a resource.
  • This frame includes only the header of the message and allows the client to know ahead of time which resource the server will push.
  • In case the client already cached the resources, the client can decline the push by sending a RST_STREAM frame in response.
  • This allows stopping the client to send duplicate requests.

Header compression

  • With HTTP/1.1 a new TCP connection has to be provided for every asset requested.
  • HTTP/2 can send all the headers in a single connection utilizing compression.
  • HTTP/1.1 uses gzip compression. HTTP/2 instead, uses HPACK which is more powerful and secure than gzip.
  • HPACK compresses the individual value of each header before it is transferred to the server.

As we have seen there has been lots of improvement is in HTTP2, still, most of the companies are relies on HTTP/1.1.

That’s It

Happy Learning.

--

--