Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

HTTP vs HTTPS
CN

HTTP vs HTTPS

Master the protocol that runs the web: Understand Statelessness, Headers, and the security of TLS.

HTTP (Hypertext Transfer Protocol) is the foundation of data communication on the web. HTTPS adds encryption via SSL/TLS.

HTTP

  • Port: 80
  • Stateless: each request is independent — the server doesn’t remember previous requests
  • Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • Status codes: 2xx (success), 3xx (redirect), 4xx (client error), 5xx (server error)
  • Headers: metadata about the request/response (Content-Type, Authorization, Cache-Control)

Statelessness

The server does not store any information about the client between requests. To maintain session state, we use:

  • Cookies — server sends a token, client sends it back on every request
  • JWT (JSON Web Tokens) — stateless auth tokens embedded in requests
  • Sessions — server-side storage referenced by a cookie ID

HTTPS (HTTP + TLS)

  • Port: 443
  • Encryption: all data is encrypted between client and server
  • Authentication: server presents a certificate signed by a trusted CA (Certificate Authority)
  • Integrity: data cannot be modified in transit without detection

TLS Handshake

Client                               Server
  │─── ClientHello (ciphers, TLS version) ─→
  │←── ServerHello + Certificate + KeyEx ───│
  │─── ClientKeyExchange + Finished ───────→│
  │←── Finished ────────────────────────────│
  │         Secure communication begins      │
  1. Asymmetric encryption (RSA/ECDSA) is used to securely exchange a symmetric key
  2. Symmetric encryption (AES) is used for the bulk data — much faster

Common HTTP Status Codes

CodeMeaningTypical use
200OKSuccessful response
301Moved PermanentlyURL redirected permanently
400Bad RequestClient sent malformed data
401UnauthorizedAuthentication required
403ForbiddenAuthenticated but not allowed
404Not FoundResource doesn’t exist
500Internal Server ErrorServer-side failure
503Service UnavailableServer overloaded or down

Q: Why is HTTPS better than HTTP?

A: Encryption (no one can read your data in transit), Authentication (you know you’re talking to the real server, not an imposter), and Integrity (data can’t be modified in transit). HTTP sends everything in plain text.

Q: What does “stateless” mean in HTTP?

A: Each request is independent — the server doesn’t store any client context between requests. Cookies, sessions, and JWTs add state on top of the stateless protocol.

Q: Why does HTTPS use asymmetric encryption first, then switch to symmetric?

A: Asymmetric encryption (public/private key) is slow but secure for sharing a key. Symmetric encryption (same key both ways) is fast but needs both sides to have the same key. The TLS handshake uses asymmetric crypto to safely exchange a symmetric session key.

Q: What are the main HTTP methods?

A: GET (retrieve), POST (create), PUT (replace), PATCH (partial update), DELETE (remove), HEAD (headers only), OPTIONS (available methods). GET is idempotent and safe; POST is neither.

My Private Notes

Notes are auto-saved locally to this device.