Application protocols
Introducido
7:25
Redes de computadoras
A network carries your bytes across a planet of machines that owe each other nothing. The first three units move a frame: layering, the link layer with IP, and…
Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar
En esta lección
| English | Significado |
|---|---|
| DNS/ˌdiː en ˈes/ | Sistema de nombres de dominio |
| delegation/ˌdelɪˈɡeɪʃn/ | handing responsibility for part of the DNS name space to another server |
| HTTP/ˌeɪtʃ tiː tiː ˈpiː/ | Protocolo de transferencia de hipertexto |
| headers | |
| status code/ˈsteɪtəs kəʊd/ | |
| multiplexing/ˌmʌltɪˈpleksɪŋ/ | carrying several streams over one connection or link |
| stateless/ˈsteɪtləs/ | keeping no memory of earlier requests between one request and the next |
Resolver el nombre
- DNS convierte un nombre en una dirección mediante delegación jerárquica: la raíz conoce los servidores TLD,
.comconoce los registradores, el servidor autoritativo conoce el host. Cada respuesta es una referencia descendente, y la caché salta el recorrido para la TTL de la respuesta. - HTTP es una gramática de solicitud-respuesta: línea de solicitud, encabezados, línea en blanco, cuerpo — y los códigos de estado son la promesa: 2xx éxito, 3xx redirección, 4xx error del cliente, 5xx error del servidor.


DNS delegation means the root answers with —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Each level refers downward; the authoritative server holds the host record.
Put an uncached DNS lookup of www.example.com in order.
Dificultad 3/5 · 200 monedas + un pequeño bono en el primer intento de hoy
Every answer except the last is a referral one level down. The cache is why most lookups skip the whole walk.
Una página, por los bytes
GET /index.html HTTP/1.1con un encabezado Host; el servidor responde200 OK, encabezados (Content-Type,Content-Length: 128), línea en blanco, exactamente 128 bytes de cuerpo.- La línea en blanco es portante: el analizador espera exactamente esos dos saltos de línea. Content-Length cuenta solo los bytes del cuerpo — los encabezados se cuentan por la posición de la línea en blanco.
The header block ends at —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Two newlines end the headers - the parser waits for exactly those.
Códigos como promesas
- 200 (aquí está el cuerpo), 301 (se movió —
Locationdice dónde), 404 (preguntaste mal), 500 (me equivoqué). Un rastreador trata 301 como un puntero, 404 como un callejón sin salida, 500 como reintentar más tarde. - Una tabla de nombres global sería una falla global: la delegación divide tanto el dominio de fallos como los datos.
A 301 response tells the client —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Redirect: the resource lives elsewhere now.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Caching and HTTP versions
Cache-Control: max-age=3600lets a browser reuse a response for an hour without any request. After that it checks again with theETag: if nothing changed, the server sends304 Not Modifiedwith no body.- HTTP/1.1 keeps connections open; HTTP/2 sends many requests at once over one TCP connection (multiplexing 多路复用); HTTP/3 runs over QUIC on UDP, so one lost packet no longer holds up every stream.
- A DNS lookup with nothing cached asks the root, the TLD and the authoritative server: $3$ queries.
A server answers a revalidation with 304 Not Modified. The browser —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
304 means the cached copy is still valid, so no body is sent.
A resolver has the .com TLD server cached but not the domain. How many queries does it send to resolve www.example.com?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
It skips the root: one query to the .com server, one to the authoritative server.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
A stateless protocol that remembers you
- HTTP keeps no memory between requests (it is stateless 无状态). After a login the server sends
Set-Cookie: session=7f3a…, and the browser returns that cookie with every later request to the site. - The server looks up the session and knows who is asking. Mark session cookies
SecureandHttpOnly, so they travel only over HTTPS and page scripts cannot read them.
By default an HTTP server remembers each client between requests.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
HTTP is stateless; cookies carry the state.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Worked example: ten images at 50 ms
- A page has its HTML and 10 small images, and the round trip is 50 ms. HTTP 超文本传输协议/1.1 on one connection: 1 RTT to connect, 1 for the HTML, then 10 requests one after another: $12 \times 50 = \mathbf{600}$ ms.
- HTTP/2 sends all 10 requests together on that connection: $1 + 1 + 1 = 3$ RTTs, 150 ms. Browsers once opened six connections side by side to get part of this gain.
HTTP/1.1, one connection, RTT 50 ms: connect, HTML, then 10 images one at a time. Total (ms)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$(1 + 1 + 10) \times 50 = 600$ ms.
Same page over HTTP/2 with the 10 requests multiplexed: total (ms)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$3 \times 50 = 150$ ms.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Marks that slip away
- Forgetting the blank line. Headers 首部 end at an empty line; without it the server keeps waiting.
- Counting headers in
Content-Length. It counts body bytes only. - A 404 for a moved page. Answer
301with aLocationheader; a 404 tells crawlers the page is gone.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Recap
- DNS delegates: root, TLD, authoritative; caching skips the walk for the TTL.
- HTTP 超文本传输协议: request line, headers, a blank line, then exactly Content-Length body bytes.
- 2xx success, 3xx redirect, 4xx client error, 5xx server error.
¿Qué salió mal? Solo el equipo del sitio ve esta información.