What is HTTP

Quick Reference: TCP vs UDP | WebSockets


Quick Reference

AspectHTTP/1.1HTTP/2HTTP/3
MultiplexingNoYesYes
Header CompressionNoHPACKQPACK
TransportTCPTCPQUIC (UDP)
Server PushNoYesYes
PerformanceBaselineBetterBest

Clear Definition

HTTP (HyperText Transfer Protocol) is the foundation of data communication on the web. It's a request-response protocol that enables clients to fetch resources from servers.

šŸ’” Key Insight: HTTP is stateless, meaning each request is independent. State is maintained through cookies, sessions, or tokens.


Core Concepts

HTTP Methods

  • GET: Retrieve data (idempotent, safe)
  • POST: Create data (not idempotent)
  • PUT: Update/replace data (idempotent)
  • PATCH: Partial update (not idempotent)
  • DELETE: Delete data (idempotent)

HTTP Status Codes

  • 2xx Success: 200 OK, 201 Created, 204 No Content
  • 3xx Redirection: 301 Moved, 304 Not Modified
  • 4xx Client Error: 400 Bad Request, 401 Unauthorized, 404 Not Found
  • 5xx Server Error: 500 Internal Error, 503 Service Unavailable

HTTP/2 Features

  • Multiplexing: Multiple requests over single connection
  • Header Compression: HPACK compression
  • Server Push: Server can push resources proactively
  • Binary Protocol: More efficient than text-based HTTP/1.1

HTTP/3 Features

  • QUIC Protocol: Built on UDP instead of TCP
  • Faster Connection: Reduced handshake time
  • Better Multiplexing: Improved over HTTP/2
  • Connection Migration: Handles network changes better

Best Practices

  1. Use Appropriate Methods: GET for reads, POST for creates
  2. Proper Status Codes: Return correct status codes
  3. Idempotency: Make operations idempotent when possible
  4. Caching: Use appropriate cache headers

Quick Reference Summary

HTTP: Request-response protocol for web communication. Stateless, uses TCP.

HTTP/2: Multiplexing, header compression, server push. Better performance.

HTTP/3: Built on QUIC (UDP), faster connections, better performance.


Previous Topic: TCP vs UDP ←

Next Topic: WebSockets →

Back to: Step 5 Overview | Main Index