Saltar al contenido ForoHackers

HTTP: start here

HTTP
#3425 · · Citar · 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

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder