Book 0 · Lesson 0.4

How the internet routes packets

  • Name the layers from DNS to HTTP body
  • Read curl -v output and map lines to hops

Prerequisites: 0.5

Lesson 0.5 covered who talks (client/server). This lesson covers how bytes travel between them.

Layers (simplified)

Your curl command

      ▼ DNS (name → IP)
      ▼ TCP (reliable port :8081)
      ▼ HTTP (method, headers, JSON body)
      ▼ HTTP response back

On localhost you skip wide-area routing, but the same stack applies — useful when you later debug real networks.

1
ApplicationDNS lookup
localhost → 127.0.0.1 (or ::1)
2
TransportTCP handshake
SYN → SYN-ACK → ACK on port 8081
3
ApplicationHTTP request line
POST /webhooks/hello HTTP/1.1
4
ApplicationHTTP headers
Host: localhost:8081 · Content-Type: application/json · Content-Length: …
5
ApplicationHTTP body
JSON bytes cross the socket as raw payload
6
ApplicationHTTP response
HTTP/1.1 200 OK · Content-Type: application/json · body

curl -v is your X-ray

Verbose mode prints each phase:

curl -v -X POST http://localhost:8081/webhooks/hello \
  -H 'Content-Type: application/json' \
  -d '{"source":"github"}'

Look for Connected to, > POST, < HTTP/1.1 200.

Team Radar tie-in

Every GitHub webhook simulation crosses this path before Kafka ever sees a message. If TCP fails, ingestion logs never run.

Teach-back prompt

Which hop is still HTTP if you switch port 8081 → 8443 with HTTPS?

curl -v dissection

Lesson 0.4 check

1. HTTP runs on top of…