DNS and HTTP
A browser needs both a destination address and a language for asking that destination for a resource. Without name resolution and explicit message semantics, reachable packets still cannot produce a useful web response. We will trace DNS caching, read HTTP methods and statuses, and compare the transports used by successive HTTP versions.
#Section 33DNS hierarchy, records and caching
DNS resolves names to typed records through authority and caches. Finch’s browser can reuse a valid answer or ask a recursive resolver for example.com.
On a cold lookup, the resolver asks a root server where the relevant top-level domain is served, then asks a TLD server where the domain’s authoritative servers are, then asks an authoritative server for the desired record. These are iterative referrals inside the resolver’s work. A recursive request instead asks another server to obtain the final answer on the caller’s behalf. Root servers do not contain every site’s final address.
An A record carries an IPv4 address and AAAA an IPv6 address. CNAME aliases a name, MX identifies mail exchanges, NS delegates authority, TXT carries text, PTR provides reverse naming, and SOA describes a zone’s administrative and refresh information. A name can have several address records, and its mail destination need not match its web destination. An authoritative negative answer can also be cached under defined rules.
The time to live, or TTL, bounds cache reuse. In the illustrative DNS example, a 300 second TTL cached 120 seconds ago has 180 seconds remaining. That TTL concerns a cached record, unlike the hop-limiting IP TTL. Shortening the authoritative value does not retroactively shorten copies already cached elsewhere.
DNS commonly uses UDP for queries but supports TCP when required, including responses that cannot fit the negotiated datagram conditions. Encrypted transports add another path to the resolver rather than changing what A means. The DNS architecture separates authority, recursion and caching. A useful incident report identifies the queried name, record type, resolver and observed remaining lifetime.
#Section 34HTTP methods and status codes
HTTP gives request and response bytes methods, resources, headers, and bodies. Reaching the server’s transport listener does not establish which application operation succeeds.
Methods
GET retrieves a representation and HEAD requests equivalent response metadata without the response body. OPTIONS asks about communication options. These methods are safe because their defined purpose does not request a state change, although logging can still occur. PUT replaces the target representation, DELETE requests its removal, POST asks the resource to process supplied content, and PATCH applies a described modification. Idempotence means repeating the intended request has the same intended effect as performing it once; response codes need not be identical.
Status codes
200, 201 and 204 mean success with a normal response, created resource or no content respectively. 301 and 302 redirect, while 307 and 308 explicitly preserve the method on redirect. 400 reports a malformed request, 401 requires authentication, 403 refuses permission, 404 lacks a resource, 409 conflicts with state, and 429 rejects excess demand. 500 is an internal server error, 502 an invalid upstream response, 503 unavailability and 504 an upstream timeout.
A timeout after POST leaves an uncertain effect. The server may have processed it and lost the reply. Idempotent semantics or an application idempotency key lets a retry avoid creating another purchase. PUT’s replacement intent differs from PATCH’s modification instructions; a PATCH that increments a counter is not inherently idempotent. HTTP semantics defines these contracts independently of TCP reliability. An interview answer should describe the operation and replay risk, then choose the method.
#Section 35HTTP headers, validators and caching
A cache validator identifies a stored representation. ETag and If-None-Match let a conditional GET check it; a match can return 304 Not Modified without the body.
304 response lets the browser reuse its stored bytes.Host identifies the intended virtual host in HTTP/1.1. Content-Type describes the body format, Content-Length describes its length where that framing applies, and Accept describes acceptable response types. Authorization carries authentication information, Cookie returns browser-held cookie values, and Set-Cookie asks the browser to store them. Location identifies a redirect or another relevant resource. User-Agent identifies the client software’s chosen product description; it is not a trustworthy authentication statement.
Cache-Control controls storage and freshness. no-cache requires validation before reuse rather than forbidding storage; no-store directs caches not to store the exchange. private limits shared caching, and public cacheability needs care when responses vary by authorization or cookie. Last-Modified can support time-based validation, while Vary identifies request headers that distinguish representations. A cache key omitting a meaningful variant can return someone else’s content.
For an illustrative 300 second freshness budget with 120 seconds of age and no other age contributions, 180 seconds remain. HTTP’s actual age calculation includes response timing and Age metadata, so the simplified subtraction is a teaching case. A DNS TTL with the same values expires a name answer; it does not expire a web representation.
The HTTP caching specification describes shared and private caches. The interviewer usually wants the difference between freshness, which permits reuse without asking, and validation, which contacts the server to check a stored copy. That distinction also explains why invalidation is harder across independently cached copies.
#Section 36HTTP versions and head-of-line blocking
HTTP versions change connection use and framing. Repeated setup and shared ordering can delay a page’s independent resources even while their application meanings remain the same.
HTTP/1.0 and HTTP/1.1
HTTP/1.0 commonly closed a connection after an exchange, although extensions could support persistence. HTTP/1.1 made persistent connections the ordinary model and supports chunked transfer framing. Pipelining sends requests before earlier responses finish, but their responses must remain in the relevant order. A slow response can therefore delay later responses on that connection.
HTTP/2
HTTP/2 uses binary frames, distinct streams and header compression. Several requests can make progress within one TCP connection without requiring HTTP/1.1 response ordering. Yet TCP still delivers one ordered byte stream. A missing TCP segment delays every HTTP/2 stream whose later bytes sit behind that gap.
HTTP/3
HTTP/3 carries HTTP over QUIC. Distinct QUIC streams have distinct delivery order, so loss affecting one stream need not hold the already received bytes of another. Shared congestion limits and connection-level resources still couple their capacity. Saying HTTP/3 removes every kind of waiting would be wrong.
In Finch’s simplified cold TCP and TLS trace, setup and the first response consume 120 ms at 40 ms per sequential RTT. Reusing a connection can avoid the setup portions; multiplexing does not remove geographic propagation. A warm cache can avoid the request entirely. State the cache and connection assumptions before comparing protocols by a latency number.
The HTTP/2 specification and HTTP/3 specification define their framing separately. The useful historical change is repeated connection setup becoming persistence, then stream multiplexing, then independent transport streams. The next part examines the QUIC and TLS mechanisms that make the final change possible.