What Is HTTP? β Definition and How It Works
Learn what HTTP is, the anatomy of a request and response, what methods and status classes mean, and how the protocol versions differ.
HTTP is the protocol the web runs on. A client sends a request describing what it wants; a server sends a response containing a status, headers, and usually a body.
1. The Request
GET /api/v1/items?limit=10 HTTP/1.1
Host: api.example.com
Accept: application/json
User-Agent: example-client/1.0
A method, a target, a version, and headers β with a body for methods that send data.
2. The Response
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=60
{"items": [...]}
A status line, headers describing the payload and caching, and the body.
3. Methods
| Method | Meaning | Safe | Idempotent |
|---|---|---|---|
| GET | Retrieve | Yes | Yes |
| HEAD | Retrieve headers only | Yes | Yes |
| POST | Submit, often creating | No | No |
| PUT | Replace | No | Yes |
| PATCH | Partially modify | No | No |
| DELETE | Remove | No | Yes |
| OPTIONS | Ask what is permitted | Yes | Yes |
Safe means no intended side effect; idempotent means repeating it has the same effect as doing it once. Both matter when deciding whether a failed request may be sent again.
4. Status Classes
- 1xx β informational, rarely seen directly.
- 2xx β success.
- 3xx β redirection; go elsewhere.
- 4xx β the caller must change something.
- 5xx β the server failed.
The class alone answers who owns the fix, which is the fastest triage available.
5. Statelessness and Cookies
HTTP is stateless: each request is independent, and the server remembers nothing between them. Sessions exist because the server sets a cookie and the client returns it.
That is why a client discarding cookies faces every login and consent step repeatedly β it is presenting as a first-time visitor each time.
6. The Versions
| Version | Characteristics |
|---|---|
| HTTP/1.1 | Text-based, one request at a time per connection, keepalive |
| HTTP/2 | Binary, multiplexed streams over one connection, header compression |
| HTTP/3 | Over QUIC on UDP, removing head-of-line blocking at the transport |
Multiplexing in HTTP/2 removed the need for many workarounds built around HTTP/1.1's serialisation, and its framing choices also became a way to identify client implementations.
7. What Travels With Every Request
Headers carry authentication, content negotiation, caching directives, and client identity. They are also, collectively, characteristic of the client sending them β which is why the set and its ordering matter beyond their individual meanings.
8. Summary
HTTP exchanges requests and responses composed of a method or status, headers, and an optional body, statelessly, with cookies supplying continuity.
Methods declare intent and idempotency; status classes assign ownership of a failure; and the version determines how requests share a connection. Nearly everything else on the web is built on those few ideas.