Loading
0x60Lesson 7 of 7

Follow a web request safely

Connect DNS, transport, HTTP, and TLS in a browser request.

15 min 4-question quiz 1 code exercise
By the end of this lesson you can
  • Trace a URL through name resolution to an HTTP response.

HTTP is an application-level request/response protocol. A request names a method and target; a response carries a status code, headers, and possibly a body. With HTTPS, TLS protects the connection and authenticates the server using certificates. DNS can find an address for a name, while a certificate helps verify that the peer is authorized for that name.

network_demo.py
1request = {"method": "GET", "path": "/lessons", "host": "learn.example"}
2response = {"status": 200, "body": "Welcome"}
3print(f"{request['method']} {request['path']} → {response['status']}")
4print(response["body"])
Output
GET /lessons → 200
Welcome

A simplified HTTPS trip is: resolve the host name, establish a transport connection, negotiate TLS and check the certificate, then exchange HTTP messages. Modern HTTP can use different transport mappings, so this is a conceptual view of a common HTTP/1.1 or HTTP/2 connection.

Key takeaways

  • Trace a URL through name resolution to an HTTP response.

  • The code examples simulate protocol behavior; they do not send network traffic.

  • Use the layer model to locate where an address, port, or message belongs.

Lesson quiz

4 questions · pass with 3 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: model networking concepts

Use small Python programs to model packet, address, and protocol behavior. These exercises run locally in your browser and do not send network traffic.

Exercise 1

Classify a web URL

+25 XP

Read a URL and print HTTPS scheme: TLS expected for an https:// URL, or HTTP scheme: TLS not requested otherwise. This is a simple scheme check, not a real TLS verifier.

  • HTTPS scheme
  • HTTP scheme
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Did you like the lesson? 😆👍
Consider a donation to support our work: