Wiki DE Start in the browser

Wiki › Protocols

HTTP

How the browser fetches a web page: URL, DNS, TCP connection, GET request, status code and response – byte by byte.

Layer
7 (Anwendung, über TCP 80)
Standard
RFC 9112, RFC 3986, RFC 9110 …
See an example
See demo

Fetching a page

The address http://www.schule.example/stundenplan.html consists of scheme (http), host name and path. The browser:

  1. asks DNS for the address of www.schule.example,
  2. opens a TCP connection to port 80,
  3. sends a request,
  4. receives the response with status code and content and displays it.
GET /stundenplan.html HTTP/1.1
Host: www.schule.example

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 412

<h1>Timetable</h1>…
Browser fetches a page: DNS, TCP connection, HTTPBrowser fetches a page: DNS, TCP connection, HTTP
Slow motion Browser fetches a page: DNS, TCP connection, HTTP

Status codes

CodeMeaning
200 OKall fine
301 / 302moved, the new address follows
404 Not Foundthe page does not exist
500error on the server

Content-Length counts bytes, not characters: a “ü” needs two bytes in UTF-8.

HTTPS and TLS

HTTPS is HTTP inside a TLS connection (today TLS 1.3, RFC 8446), usually on port 443 (scheme https, RFC 9110, Section 4.2.2). TLS provides three things:

  • Confidentiality: the content is encrypted; only addresses, ports and the server name remain visible.
  • Integrity: changes on the way are noticed.
  • Authenticity: the server identifies itself with a certificate signed by a certificate authority (CA). The browser checks whether name and signature match.

Before the first HTTP packet, browser and server negotiate methods and keys in the handshake. leyoNET does not simulate TLS: web pages run over HTTP so that every header and every content can be read in the packet list. That shows exactly why HTTPS is needed in a real network.

In leyoNET

A server becomes a web server under Advanced → Services; the pages are your own HTML, also with small images. The browser on the desktop shows every step (DNS, TCP, GET, response) and the page; links in it trigger new simulated requests.

The start page of a new web server shows, on every request, the name and address of the web server and the address the request came from. This uses Server Side Includes as in the Apache web server: <!--#echo var="SERVER_NAME" --> (name), SERVER_ADDR (server address) and REMOTE_ADDR (client address). The server replaces them before sending the page, so the packet list already shows the value. With a Load balancer or NAT in between, REMOTE_ADDR shows its address instead of the PC's.

HTTPS with real encryption is not available.

How to do it in leyoNET

The same text as in the app’s help (F1 key).

Web server and browser

The web server serves your own pages: edit index.html and upload a small image (it is shrunk, at most 160 kB, so the project file stays small). The browser resolves the name via DNS, opens a TCP connection (SYN, SYN-ACK, ACK), sends GET and then loads embedded images. All per HTTP/1.1.

The start page shows the name and address of the web server and the address of the client. This is done by Server Side Includes, which the server replaces on every request: <!--#echo var="SERVER_NAME" -->, SERVER_ADDR and REMOTE_ADDR. They also work in your own pages.

See an example

  • DNS, TCP and HTTP

    A notebook fetches a web page through a router.

    DNS query for www.schule.example, TCP handshake (SYN, SYN-ACK, ACK) and the HTTP request in the browser.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★☆☆ Open a web page via DNS · 3 goals · Worksheet (German)
  • ★★★★☆ Web server with its own public address · 2 goals · Worksheet (German)
  • ★★★☆☆ Reaching the NAS from outside · 2 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
HTTP/1.17GET, Content-Length in bytes (UTF-8), images as binary data; Server Side Includes only echo with SERVER_NAME, SERVER_ADDR, REMOTE_ADDR in HTML pages; no HTTPS

Standards

  • RFC 9112 – HTTP/1.1
  • RFC 3986 – Uniform Resource Identifier (URI): Generic Syntax
  • RFC 9110 – HTTP Semantics
  • RFC 8446 – The Transport Layer Security (TLS) Protocol Version 1.3

Read on

Found a mistake or have an idea? Source of this page on GitHub.