Deep dive into HTTP

Abhay Jain
3 min readDec 3, 2020

--

HTTP was created by Tim Berners-Lee to allow communication between a server and a client. It is this communication that forms the basis of the Internet. HTTP is the TCP/IP-based application-layer communication protocol. It defines how the content is requested and transmitted across the internet.

By default TCP port 80 is used but other ports can be used as well. HTTPS, however, uses port 443.

HTTP Request:

HTTP request comprises of the following:-

  • Start-line — This describes the HTTP Method (such as Get, Put, or Post), the request-target (such as an URL, or Port), and the HTTP version (such as HTTP/1.1). This start-line is always a single line.
  • Request Headers — An optional set of HTTP headers specifying the request. Types of Headers are explained below..

Request Headers: Includes User-Agent, Accept-Type, Accept-Language.

General Headers: Includes Connection.

Entity Headers: Includes Content-Type or Content-Length.

  • Blank Line This confirms that all the request meta-data has been sent.
  • Body (Optional) — This contains all the data associated with the request. There are typically two categories explained below..

A body consisting of one single file, defined by the Content-Type and Content-Length Entity Headers.

A multipart body. One example could be a request containing information in an HTML form.

HTTP Response:

HTTP response comprises of the following:-

  • Start-line — This usually includes the HTTP protocol version (HTTP/1.1), a status code (such as 200 or 404), and a textual description of the status code (such as “ok”).
  • Response Headers — An optional set of HTTP headers specifying the request. There are multiple different types of headers:

Response Headers — such as Vary and Accept-Ranges provide more information about the server.

General Headers — such as Via apply to the whole message.

Entity Headers — such as Content-Length, or Last-Modified apply to the body of the response.

  • Body — This contains all the data associated with the request. There are typically two categories:

A body consisting of one single file, defined by the Content-Type and Content-Length Entity Headers.

A body consisting of one single resource of unknown length and encoded by chunks (Transfer-Encoding set to Chunked).

A multi-part body, with each part containing different information. These are not common.

History of HTTP:-

  • HTTP 0.9 (1991) — It consisted of a single line containing a GET method and the path of the requested document. The response was just returning a single hypertext document without headers or any other metadata.
  • HTTP 1.0 (1996) — Addition was Request headers and Response headers. Also, the new response headers allowed multiple file types, such as HTML, plain text, images, and more.
  • HTTP 1.1 (1997) — This new version becomes the Internet Standard. This version added many performance enhancements, such as keepalive connections, caching mechanisms, request pipelining, transfer encodings, and byte-range requests.
  • HTTP 2.0 (2015) — This improved the performance of HTTP.
  • HTTP 3.0 (Late 2019) — Based on the QUIC protocol, explained below.

More About HTTP 2.0 — Majorly Used

The key differences HTTP/2 has to HTTP/1.x are as follows:

  • It is binary, instead of textual
  • It is fully multiplexed, instead of ordered and blocking
  • It can use one connection for parallelism
  • It uses header compression to reduce overhead
  • It allows Server Pushing to add responses proactively into the Browser cache.

Future is Here — HTTP 3.0

HTTP/3 is an evolution of the QUIC (Quick UDP Internet Connections) protocol from Google, first suggested by Mark Nottingham in October 2018.

QUIC is similar to TCP+TLS+HTTP 2.0 but is implemented on top of UDP(User Datagram Protocol). UDP is essentially TCP without all the error checking. UDP packets are received by the recipient more quickly. The sender will not have to wait to ensure the packet has been received. UDP is used when speed is more important than the occasional lost packet, such as live broadcasts or online gaming.

Key features of QUIC:

  • Dramatically reduced connection establishment time
  • Improved congestion control
  • Multiplexing without head-of-line blocking
  • Forward error correction
  • Connection migration

--

--

Abhay Jain
Abhay Jain

Written by Abhay Jain

Developer with 3 yrs of industrial experience in developing scalable web applications.

Responses (1)