HTTP in a nutshell.

Pranav BawgikarPranav Bawgikar
3 min read

[42]

Introduction

HTTP (Hypertext Transfer Protocol) is the foundation of data communication on the internet. It's a protocol that allows clients (usually web browsers) to request resources (like web pages) from servers.

HTTP Requests

HTTP Methods

You can read about them here.

URL vs/ URI vs/ URN

  1. URI (Uniform Resource Identifier): A URI is a string of characters that identifies a resource, either by location, name, or both. It’s the most general identifier. URL and URN are subtypes of URI.

  2. URL (Uniform Resource Locator): A URL is a subtype of URI that specifies how to locate a resource on the web. It includes the protocol (e.g., https), domain, and often a path. A URL fully describes the means to access a resource. For example, https: //example .com/path/to/resource. It can also be used with other protocols like FTP.

  3. URN (Uniform Resource Name): A URN is also a subtype of URI but identifies a resource by name within a specific namespace, rather than by location. It uses the urn scheme. URNs cannot be used to locate a resource. A URN is a globally unique identifier that stays consistent regardless of the resource’s location. For example, urn:isbn:0361450721 identifies a book by its ISBN, which doesn’t change even if stored in different locations.

In short, every URL is a URI, but not every URI is a URL. URNs are unique names, URLs are locators, and URIs encompass both types.

Headers

It represents additional information about the request. Like, user-agent/client info, preferred response format and cookies or state information.

Body (for POST and PUT)

Data sent to the server (e.g., form data, JSON).

HTTP Response

Status Codes

You can read about HTTP status codes here.

Headers

It represents metadata about the response, the content-type, the format of the response data. and set-cookie to send cookies to the client.

Body

Data/content sent back (e.g., HTML, JSON).

HTTP Versions

  1. HTTP/1.1 (common) and HTTP/2 (optimized for performance).

  2. HTTP/3 (based on QUIC, focused on speed and reliability).

HTTP/2 Features

  • Multiplexing: Multiple requests over one connection.

  • Header Compression: Reduced overhead.

  • Server Push: Proactively sending resources.

HTTP/3 Features

  • Based on QUIC for improved speed and reliability.

  • Reduces latency and connection establishment time.

HTTPS (Secure HTTP)

  • HTTP + TLS/SSL encryption for secure data transmission.

Headers

  • Request Headers: Sent by the client.

  • Response Headers: Sent by the server.

  • Common Headers: User-Agent, Content-Type, Accept.

Cookies

Cookie is an object or small pieces of data stored by the browser for state management, containing client information that can be accessed by the server.

CORS (Cross-Origin Resource Sharing)

Mechanism controlling which domains can access resources on a web page.

REST (Representational State Transfer)

You can read more about REST API here.

WebSockets (WebSocket Protocol)

Provides full-duplex, bidirectional communication over a single, long-lived connection. In summary, HTTP requests involve a client making a request to a server, the server processing the request and sending a response back to the client. The client and server communicate using the HTTP protocol, and the response includes a status code indicating the outcome. HTTP is the backbone of web communication, enabling the retrieval and exchange of resources on the internet.

0
Subscribe to my newsletter

Read articles from Pranav Bawgikar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pranav Bawgikar
Pranav Bawgikar

Hiya 👋 I'm Pranav. I'm a recent computer science grad who loves punching keys, napping while coding and lifting weights. This space is a collection of my journey of active learning from blogs, books and papers.