HTTP protocol

As a software developer, there is a 99% chance you will use the HTTP protocol.
Here are 8 things you need to know about it: ↓
1. What is HTTP
HTTP is an application-level protocol based on a request-response paradigm.
Its primary use is encoding and transporting information between a client and a server.
A typical HTTP transaction is made of 2 steps:
• a client sends a request message to a server
• the server replies with a response message
2. HTTP messages
A message is a block of text composed of multiple fields.
The main fields of an HTTP message are:
• the start line, indicating what a request is for or if the request was successful
• the headers, composed of key-value pairs metadata describing the message
• the (optional) body containing the data
3. Requests
An HTTP server hosts resources like documents, images, or collections of other resources.
HTTP requests allow you to Create, Read, Update, or Delete these resources.
Each request is stateless and contains all the necessary information to process it.
4. Request methods
The requested CRUD operation is specified in the start line of the message by a request method.
The most commonly used methods are:
• GET: retrieve a resource
• PUT: update a resource
•POST: create a resource returning its URL
• DELETE: remove a resource
5. Properties
A request method can have 2 important properties:
• Safety: the method has no side effects and can be cached. GET is safe, PUT, POST, DELETE, no
• Idempotency: the method can execute multiple times with the same result. GET, PUT, DELETE are idempotent, POST no
6.Responses
HTTP responses contain a status code informing the clients if their requests succeed.
There are different code ranges:
• 200-299 indicate success
• 300-399 communicate a redirection
• 400-499 communicate client errors
• 500-599 indicate server errors
7. Transport layer
HTTP needs a transport layer protocol to ensure a reliable and secure communication channel.
Usually, this protocol was TCP, but the latest HTTP version uses its UDP-based transport protocol.
When HTTP runs on top of TLS, it's referred to as HTTPS.
8. Versions
HTTP has multiple versions:
• 1.1 a TCP connection can be used for multiple transactions, but those need to be serialized
• 2.0 multiple transactions can be multiplexed on a TCP connection
• 3.0 an UDP transport protocol further optimizes the communication



