Highlights

Contents

Part II
02

HTTP versions and TLS

We carry an application request across the connection. Protocol versions change how requests share it. We will compare HTTP versions and then establish what HTTPS protects.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1DNS, TCP and UDP2HTTP versions and TLS3REST, gRPC, WebSocketsand SSE4Proxies, L4/L7 andconnection pools5Timeouts, retries andbackoff6Idempotency, polling andpush7Case study: one requestend to end

#Section 7What an HTTP exchange actually contains

The browser asks Heron for a score and the server sends a representation. HTTP, the Hypertext Transfer Protocol, defines the meaning of that exchange. A request has a method, a target, fields, and sometimes content. A response has a status and fields plus content when its semantics allow it. A method’s defined behavior matters because clients and intermediaries make decisions from it.

A representation is data describing a resource at some point, such as a JSON score document. The resource is the concept identified by the URI; the representation is the bytes used to describe it. Heron can return JSON for an application and HTML for a human without treating them as unrelated matches.

In the illustrative read, GET /matches/m7 asks for the current match representation. A successful response can include a validator that lets a later request ask whether its cached representation is still suitable. Authentication, resource permission, freshness, and error policy remain application decisions. HTTP gives the exchange a vocabulary; it does not know which scorer owns a match.

THE REQUEST NAMES A RESOURCE; THE RESPONSE CARRIES ONE REPRESENTATIONTHE REQUEST NAMES A RESOURCE; THE RESPONSE CARRIES ONE REPRESENTATIONrequestGET /matches/m7 HTTP/1.1Host: scores.heron.testAccept: application/jsonAuthorization: Bearer …(no body)response200 OKContent-Type: jsonETag: "v12"Cache-Control: max-age=2{ match, score, clock }the validator lets a later read ask "still v12?"
Figure 1.8Illustrative request and response fields. The payload is a representation of the match.

Methods and side effects

A safe method is intended to retrieve information without requesting a state change. Idempotent method semantics mean repeating the intended operation has the same intended effect. A GET can still cause incidental server work such as logging; that does not make the client request a new score. A method label is useful only when the application honors its semantics.

If Heron puts a score-changing action behind an ordinary GET link, a crawler, prefetcher, or retrying intermediary can invoke it as though it were a read. Use an appropriate command contract and explicit permission checks. We will later add operation identity to handle uncertain command retries.

#Section 8HTTP/1.1 and ordered responses

The score and thumbnail are independent, but they share a connection. HTTP/1.1 sends messages over a byte stream and supports persistent connections. A connection can carry later requests after earlier exchanges instead of repeatedly opening a new transport. That saves setup work and lets congestion behavior continue across requests.

HTTP/1.1 also defines request pipelining, but responses to pipelined requests must appear in request order. Suppose the score request is first and waits on a database lock, while the later thumbnail is ready. The thumbnail response cannot simply appear before the score response on that pipelined connection. The application’s ordered response contract creates waiting between otherwise independent work.

ON ONE PIPELINED HTTP/1.1 CONNECTION, B WAITS BEHIND AON ONE PIPELINED HTTP/1.1 CONNECTION, B WAITS BEHIND Aclientrequests: A, then Bresponses must leave in request orderA: scorewaits on a row lockB: thumbnailready, heldABreadiness does not reorder the wire
Figure 1.9Illustrative HTTP/1.1 pipelined requests. Response order follows request order.

Browsers and clients have often used several connections instead of relying on pipelining. Separate connections can avoid that particular ordered-response wait, but each connection has its own setup, congestion state, and resource cost. More connections are a workaround with costs, not evidence that the operations became one atomic application request.

#Section 9HTTP/2 frames and streams

HTTP/2 lets the score and thumbnail make independent progress over one connection. A frame is a protocol unit carrying a piece of control information, fields, or data. A stream is one logical exchange identified within that connection. Frames from different streams can interleave, so one response need not finish before another response starts.

Use an illustrative 2,000-byte response split into 500-byte data pieces. The split produces four data pieces, because 2,000/500=42,000/500=4. This is a teaching choice, not the protocol's frame-size limit or a claim about one actual implementation. A thumbnail frame can appear between two score frames, and the client associates each piece with its stream rather than interpreting arrival order as response ownership.

HTTP/2 CUTS RESPONSES INTO FRAMES AND INTERLEAVES THEM ON ONE CONNECTIONHTTP/2 CUTS RESPONSES INTO FRAMES AND INTERLEAVES THEM ON ONE CONNECTIONscore response, 2,000 B ÷ 500 B = 4 framesA1A2A3A4thumbnail responseB1B2one TCP connection, frames tagged by stream idA1B1A2B2A3A4client reassembles stream AA1A2A3A4and stream BB1B2arrival order on the wire is not ownership; the stream id is
Figure 1.10Illustrative interleaving. Stream labels identify exchanges, while data pieces remain associated with their own stream.

The transport still has an ordered stream

HTTP/2 runs over TCP. If a TCP segment is missing, TCP cannot deliver later bytes past the gap even when those later bytes contain a complete frame for another HTTP stream. This is head-of-line blocking, where an earlier missing or unfinished item delays later useful work behind it. HTTP/2 removes HTTP/1.1's response-order constraint but does not remove TCP's ordered-byte constraint.

Flow control also matters. A receiver can limit stream and connection data so a fast sender does not create unlimited buffered bytes. A stalled stream and a saturated connection are different problems. Inspect which flow-control boundary is exhausted before attributing every pause to packet loss.

MULTIPLEXING INTERLEAVES FRAMES ON ONE CONNECTIONMULTIPLEXING INTERLEAVES FRAMES ON ONE CONNECTIONordered responsesA bodyA bodyA bodyB waitsmultiplexed framesABABABHTTP streams differ; TCP can still hold bytes behind a transport gap
Figure 1.11Multiplexed application exchanges can still share transport waiting and congestion limits.

#Section 10HTTP/3 and independent stream delivery

Imagine the lost bytes belong to the score stream while the thumbnail's data has arrived. HTTP/3 maps HTTP exchanges onto QUIC, a secure transport that uses UDP and implements its own connection and stream behavior. QUIC streams have independent ordered delivery, so missing bytes in the score stream need not prevent delivering complete bytes of the thumbnail stream.

The improvement has a precise boundary. Data inside the score stream still waits for its missing part. Congestion control and the connection's resources still couple the streams' total sending capacity. A server waiting on the same database lock can still block both application responses even when the transport could deliver them independently.

IN QUIC A LOST PACKET STALLS ONLY ITS OWN STREAMIN QUIC A LOST PACKET STALLS ONLY ITS OWN STREAMone QUIC connectionstream Astream BA1A3A2A3 waits for A2B2still shared: congestion windowand the server: one lock can still block both responses
Figure 1.12Illustrative loss in one stream. Independent delivery does not remove shared congestion or application limits.

QUIC also supports connection identity that can survive some changes to network addressing under its protocol rules. A viewer switching networks may avoid some reconnection work when the endpoints and policy support it. That is not a promise that a connection can move to any new application process with no state transfer.

Question HTTP/1.1 HTTP/2 HTTP/3
Application framing Messages Binary frames HTTP frames over QUIC
Concurrent exchanges Often separate connections Multiplexed streams Multiplexed streams
Main transport TCP TCP QUIC over UDP
Missing transport data Delays later connection bytes Delays later connection bytes Delivery gap is stream-local
Application bottleneck removed? No No No

#Section 11TLS authentication and record protection

A network observer should not read the scorer's session cookie or alter a score response. TLS, Transport Layer Security, establishes a protected channel and authenticates the endpoint under a configured trust model. For a normal browser connection, the server proves possession of a key tied to a certificate acceptable for the requested hostname.

The client checks the certificate chain against trusted issuers and verifies the requested identity, then the handshake establishes traffic secrets. Protected records provide confidentiality and integrity for subsequent bytes. A packet capture can still reveal information such as endpoints, timing, and sizes; encrypted content is not a promise that every metadata fact disappears.

THE CLIENT CHECKS THE CHAIN, THE NAME AND THE KEY BEFORE TRUSTING BYTESTHE CLIENT CHECKS THE CHAIN, THE NAME AND THE KEY BEFORE TRUSTING BYTESroot CAin the trust storeintermediate CAsigned by rootleafscores.heron.test1 chain to a trusted root2 name matches the request3 server proves it holds the key4 protected records; who may read m7 is still the app's check
Figure 1.13Conceptual TLS checks before treating the peer as the requested service. Exact handshake details depend on the protocol and mode.

Where protection ends

HTTPS is HTTP carried over TLS. If the public proxy terminates TLS, it sees plaintext HTTP and becomes part of the trusted processing path. A separate protected connection to the backend can protect the next network hop, but the proxy still has access to the data between them. Encryption in transit does not mean an intermediary doing decryption cannot read it.

TLS verifies the service endpoint, not the scorer's right to change match m7. Heron still checks session identity, match assignment, and command validity. An authenticated service can have an authorization bug, and an encrypted attacker request can still exploit it. Name each guarantee at the boundary that enforces it.

#Section 12Cold requests, warm requests, and reused protection

A fresh connection can spend more time preparing than reading a tiny score. Assume illustrative costs of 40 ms each for DNS, TCP setup, TLS setup, and the HTTP exchange. Their sum is 40+40+40+40=16040+40+40+40=160 ms. Under the stated warm-connection scenario, a suitable cached name and established connection leave the 40 ms exchange.

A COLD READ SPENDS 120 OF ITS 160 MS PREPARINGA COLD READ SPENDS 120 OF ITS 160 MS PREPARINGviewerresolverserverDNS answer: 40 msTCP setup: 40 msTLS setup: 40 msHTTP exchange: 40 msDNSTCPTLSHTTP04080120160 ms
Figure 1.14Illustrative serial preparation budget, not a universal packet or handshake count.

Real traces differ. A resolver cache can remove lookup work, TLS resumption can change setup, QUIC combines transport and security differently, and application execution adds its own delays. Overlapping or parallel work must not be added as though it were serial. Measure the critical path the user actually waits for.

Resumption still needs replay rules

Some secure connection modes permit early application data during resumption. Early data can have replay limitations: an attacker may cause the server to observe an early operation more than once. Heron must not casually accept a non-idempotent score mutation in a mode whose replay contract does not protect it. Transport optimization must fit application effect semantics.