Chapter 8

DNS and HTTP

Name resolution normally precedes connection setup, which precedes a web request. Timing problems are dependency problems: a browser cannot request an embedded object before discovering its reference unless the problem explicitly permits it.

8.1 DNS hierarchy and resource records

DNS is a distributed hierarchical database, not one central host table. A resolver asks for a record; authoritative servers hold zone data; caches retain previous answers for a limited time. Root and top-level-domain servers commonly return referrals rather than the final host address.

RecordRevision meaning
AName to IPv4 address
AAAAName to IPv6 address; record identification only
NSAuthoritative name server for a domain/zone
CNAMEAlias to canonical name; may require another lookup
MXMail exchanger with preference; record identification only
PTRReverse name lookup record
SOAZone authority and administrative parameters

An RR contains name, type, class, TTL and record data. TTL is a cache lifetime in seconds; it is not the IPv4 hop-limiting TTL. Domain-name comparisons are case-insensitive. A zone is an administratively served part of the namespace, not necessarily an entire subtree when child zones are delegated.

Ordinary DNS uses server port 53; both UDP and TCP are supported. UDP is common for simple queries, while TCP is also used for DNS and traditional zone transfer. A truncated UDP answer can lead to a TCP retry. The query ID matches responses to queries; flags include query/response, authoritative answer, truncation, recursion desired and recursion available. These details are supported by RFC 1035.

8.2 Iterative resolution and lookup cost

Past papers · CS 2014–2026 (23 papers): 1 question, 1 mark

In an iterative lookup, the resolver follows referrals and sends subsequent queries itself. In a recursive request, the requested server undertakes resolution and returns an answer or failure to its client. A stub can ask its local resolver recursively while that resolver contacts other servers iteratively. Cache hits can skip most or all of the upstream chain. See RFC 1034.

8.3 HTTP messages, persistence and cache state

Past papers · CS 2014–2026 (23 papers): 3 questions, 4 marks

HTTP defines requests and responses for resources. The URL's scheme selects the protocol context, the host is resolved through DNS, and the path identifies the resource on that server. The server's response contains a status and metadata as well as any body. Plain HTTP uses default server port 80; HTTPS uses 443 and adds a secure transport context. Base HTML and separately referenced images are separate resources and normally need separate requests unless already cached or embedded inline.

ItemMeaning
GETRetrieve a representation
HEADRetrieve response headers without the representation body
POSTSubmit content for resource-specific processing
PUTCreate or replace the target representation
DELETERequest removal of the target resource's association
200Successful response
301 / 302Redirection; may require another request
304Cached representation may be reused after validation; no representation body
400 / 403 / 404Bad request / forbidden / not found
500Server error

HTTP is stateless at the request semantics level; persistent TCP connections do not turn it into a session-state protocol. Cookies are data carried using Set-Cookie and Cookie headers, not executable programs. A server can use a cookie to identify stored application session state. Some cookies expire at a specified time; session cookies need not have a persistent expiry date. Conditional requests can use If-Modified-Since or If-None-Match to validate cached content. See HTTP semantics and cookie state management.

In the basic nonpersistent model, each object uses a new TCP connection. HTTP/1.1 normally keeps a connection persistent; pipelining permits requests to be sent without waiting for earlier responses. Responses on that pipeline remain ordered. In the ordinary same-server exam model, one connection can fetch multiple pages and objects from that server; a connection is not automatically reusable for unrelated servers. Persistence and pipeline ordering follow RFC 9112.

8.4 Web-object retrieval timelines

Past papers · CS 2014–2026 (23 papers): 5 questions, 6 marks

Let nn be the number of embedded objects discovered only after the base HTML arrives. All objects are on the same server; RTTw\mathrm{RTT}_w is its constant RTT. Ignore request/response serialisation and processing unless added explicitly, and assume no pre-existing TCP connection or cache hit.

For sequential responses, add each response's transmission time. For parallel connections sharing a bottleneck, their aggregate rate cannot exceed that bottleneck; do not give each the entire link simultaneously. For a large transfer with slow start, add the ACK-controlled rounds from Chapter 7 instead of assuming immediate full-rate streaming.

Last-minute recall

  • DNS TTL limits caching; IP TTL limits forwarding lifetime.
  • A referral is not necessarily the final address answer.
  • Recursive client service and iterative upstream resolution can coexist.
  • DNS exchange count follows delegation and cache state, not just name length.
  • HTTP statelessness does not forbid cookies or persistent connections.
  • Each uncached separately referenced object needs a request.
  • Nonpersistent HTTP needs one connection per object.
  • Pipelining removes serial request waits but not the base-page dependency.
  • Parallel connections share bottleneck capacity.
  • Count DNS, connection setup, object RTTs and serialisation only once each.

Revise offline: the whole Computer Networks handbook as one PDF

47 pages · 2.1 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections