Saltar al contenido ForoHackers

HTTP: start here

HTTP
#919 · Ophuscado · · Denunciar

HTTP is the protocol of the web: a client sends a request naming a resource and a method, and a server sends back a status, headers and usually a body. It is simple, text-shaped at its core and stateless, and nearly every web service, API and browser conversation rests on it.

Key concepts

  • Request and response: a method, a URL, headers and an optional body go out; a status code, headers and a body come back.
  • Methods and their meaning: GET reads, POST submits, PUT replaces, DELETE removes; some are safe or idempotent.
  • Status codes: families for success, redirection, client error and server error.
  • Headers: metadata for content type, caching, cookies, authentication and cross-origin rules.
  • TLS: HTTPS wraps HTTP in an encrypted, authenticated channel; use it everywhere.

Vocabulary

  • Idempotent: repeating the request has the same effect as sending it once.
  • Cache-Control: the header family that tells caches how long a response stays fresh.
  • Cookie: a small value the server asks the client to send back, used to keep sessions.
  • Keep-alive and multiplexing: reusing a connection for many requests instead of opening one for each.

What to study, in order

  1. Send a request by hand with a command-line client, and read the raw headers of the reply.
  2. Capture the same exchange in the browser's network panel and in a packet capture tool, on your own traffic.
  3. Learn the status codes you meet daily, and what each tells a client to do.
  4. Implement caching with validators and see a conditional request return a not-modified answer.
  5. Read about how newer versions of the protocol change the transport but not the meaning.

Related tags

#tcp-ip #web-standards #web-performance #api-design

Inicia sesión o únete para responder.