Client/ Server
Stateless (no link between consecutives requests) but not sessionless (with use of cookies, using Headers)
HTTP2 is used for around 40% of websites
HTTP3 is used for around 26% of websites
- HTTP/2 is more secure as it uses **binary protocol** instead of plaintext.
- Multiplexing: HTTP2 uses a single TCP connection to transmit requests and frames, thus eliminating the need for multiple connections.
- HTTP/2 **streaming** uses a prioritization tree for more efficient transmission.
- HTTP/2 reduced latency by using HPACK compression to shrink the size of headers
- HTTP/2 gives an option of **server push** to clients to further speed up the process.
ex: curl -v https://www.google.com --http2 -I
nc -nlvp 80 / telnet localhost 80
telnet google.com 80
Trying 2a00:1450:4007:819::200e...
Connected to google.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: google.com
Fragment not send to server, only for browser (for example anchors in page)
- These methods allow for Create, Read, Update, Delete operations
- An HTTP method is **safe** if it doesn't alter the state of the server
- An HTTP method is idempotent if the intended effect on the server of making a single request is the same as the effect of making several identical requests.
- All safe methods are also idempotent, but not all idempotent methods are safe
- safe/idempotent: Only semantic, no constraint in protocol
Interesting header we don't often manipulate ourselves: Host header positioned by User-Agent, containing target host.
Used for example by Kubernetes ingress to route traffic to correct host.
In HTTP/2, replaced by pseudo Header ":authority".
All pseudo headers begin with ":", they replace HTTP/1 request line and status line
We use symmetric encryption during the session because of lower overhead
Asymmetric encryption to exchange session key for security