• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

After establishing a TCP (and possibly TLS) connection, the browser needs to ask the server for a specific resource. Without a structured request format, servers wouldn’t understand what the client wants.

Core Idea

An HTTP request is a structured message from client to server containing: method (GET, POST, etc.), target URL path, headers (cookies, user-agent), and optional body (for POST/PUT).

How It Works

A typical HTTP request looks like:

GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0
Cookie: session=abc123
  1. Request Line: Method + path + HTTP version
  2. Headers: Key-value pairs (Host, User-Agent, Cookie, etc.)
  3. Body: Optional data (for POST requests with form data/JSON)

The server reads this and determines what to return.

Visual Explanation

G Browser Browser Request GET / HTTP/1.1 Host: google.com User-Agent: ... Browser->Request sends Server Server Request->Server over TCP/TLS

Key Properties

  • Methods: GET (fetch), POST (submit), PUT (update), DELETE, etc.
  • Headers provide metadata (cookies, auth, content-type)
  • Body present only for methods that send data (POST, PUT)
  • HTTP/1.1 requires Host header (virtual hosting)

Connections

Edge Cases & Gotchas

  • GET requests shouldn’t have a body (though some servers accept it)
  • Large headers can cause issues (proxy limits)
  • Missing Host header fails in HTTP/1.1
  • Request smuggling possible with malformed headers