Skip to content

URLs and HTTP messages

Module
Everyday Application Traffic
Difficulty
Easy
Updated
Tested on
Ubuntu 24.04.5 LTS, netlab 1.2, GNU Bash 5.2.21
On this page

You type http://web.lab.test/hello.txt and get a line of text back. Every part of what you typed tells a program what to do. Follow those parts to see which ones guide the connection and which ones become part of the message.

Finish Practice: How DNS Finds Services. Work in your Ubuntu VM from Installing the lab. Start at the VM prompt and keep DNS mode on for this module. If you did extra work with other modes, check netlab status and turn off modes other than DNS with netlab mode <name> off.

If you are on version 1.0 or 1.1, run the following at the VM prompt. Check that the checksum passes before unpacking. Use your Ubuntu password when prompted.

Terminal window
wget https://rootvolt.dev/downloads/netlab-1.2.tar.gz
wget https://rootvolt.dev/downloads/netlab-1.2.tar.gz.sha256
sha256sum -c netlab-1.2.tar.gz.sha256
tar -xzf netlab-1.2.tar.gz
sudo sh netlab-1.2/install.sh
netlab reset

Version 1.2 adds a lab account for the sign-in form and a certificate fault for the practice. Check with netlab version. If DNS mode is off, run netlab mode dns on. Then reset the lab.

Check the lab version and reset
learner@rootvolt:~$ netlab versionnetlab 1.2 (cast fffd977692d0)learner@rootvolt:~$ netlab reset[sudo] password for learner: Lab is back in its starting state (modes on: dns).learner@rootvolt:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.2), GNU Bash 5.2.21. Confirm netlab 1.2 and reset with DNS mode on.
Steps (9)
  1. Type netlab version
  2. Press Enter
  3. Output: netlab 1.2 (cast fffd977692d0)
  4. Type netlab reset
  5. Press Enter
  6. Output: [sudo] password for learner:
  7. Type the password (the terminal shows nothing)
  8. Press Enter
  9. Output: Lab is back in its starting state (modes on: dns).

A URL is an address that tells a program how and where to ask for something. The scheme is the part before ://. Here http selects plain HTTP, the protocol for asking a web server for something and reading its answer. The host is the name or address of the server you want to reach. In this URL, it is web.lab.test. A colon and number after the host can select a port. Here the port is left out, so HTTP uses port 80. The path is the part starting with the next slash. Here /hello.txt tells the server which file to send.

Seven questions from laptop to web The first six stations from laptop to web are answered. Station 7 is in focus: what the programs say and who else can read it. laptop web 1 2 3 4 5 6 7
Seven questions from laptop to web The first six stations from laptop to web are answered. Station 7 is in focus: what the programs say and who else can read it. laptop web 1 2 3 4 5 6 7
Stations 1 through 6 are answered. Station 7 asks what the programs say and who else can read it.

The host gives station 2 the name to look up. The scheme or written port tells station 6 which port to connect to. The path and host tell station 7 what to put in the request. Stations 1, 3, 4 and 5 use no part of the URL.

Run netlab shell laptop at the VM prompt. Use curl -v on laptop to print the exchange in detail.

Lines with * are curl’s own notes. Lines with > are sent. Lines with < are received.

Predict. Which part of the URL never appears inside the request?

Read the successful exchange
learner@laptop:~$ curl -v http://web.lab.test/hello.txt* Host web.lab.test:80 was resolved.
* IPv6: fd85:b2a8:3761:20:77:20ff:fe00:80
* IPv4: 10.77.20.80
*   Trying 10.77.20.80:80...
* Connected to web.lab.test (10.77.20.80) port 80
> GET /hello.txt HTTP/1.1
> Host: web.lab.test
> User-Agent: curl/8.5.0
> Accept: */*
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: netlab-web/1.0
< Date: Wed, 02 Dec 2026 16:58:24 GMT
< Content-type: text/plain
< Content-Length: 16
< Last-Modified: Thu, 19 Nov 2026 00:00:00 GMT
< 
Hello from web.
* Closing connectionlearner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.2), GNU Bash 5.2.21. Read curl's notes, the full request, the full response, and the file text.
Steps (3)
  1. Type curl -v http://web.lab.test/hello.txt
  2. Press Enter
  3. Output: * Host web.lab.test:80 was resolved. * IPv6: fd85:b2a8:3761:20:77:20ff:fe00:80 * IPv4: 10.77.20.80 * Trying 10.77.20.80:80... * Connected to web.lab.test (10.77.20.80) port 80 > GET /hello.txt HTTP/1.1 > Host: web.lab.test > User-Agent: curl/8.5.0 > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Server: netlab-web/1.0 < Date: Wed, 02 Dec 2026 16:58:24 GMT < Content-type: text/plain < Content-Length: 16 < Last-Modified: Thu, 19 Nov 2026 00:00:00 GMT < Hello from web. * Closing connection

Read an HTTP request and answer

* Host web.lab.test:80 was resolved.
*   Trying 10.77.20.80:80...
> GET /hello.txt HTTP/1.1
> Host: web.lab.test
< HTTP/1.0 200 OK
< Content-type: text/plain
Hello from web.
laptop
machine
eth0 · Transport
Request line · ApplicationGET /hello.txt
Host header · ApplicationHost: web.lab.test
Status · Application200 OK
Content type · Applicationtext/plain
Content · ApplicationHello from web.

Reading the output

Pick a step to match a marked part of the output to the picture.

Step-by-step reading of a captured output · Output of curl -v http://web.lab.test/hello.txt on laptop, on Ubuntu 24.04.5 LTS, netlab 1.2. The values are the capture's. Step through selected lines from the same exchange.
Steps (7)
  1. Lookup. Lookup: web.lab.test. Shown on laptop's eth0 as: laptop. The host in the URL tells curl which name to look up.
  2. Port. Port: :80. Transport layer. Shown on laptop's eth0 as: eth0. The scheme chooses plain HTTP and its default port. The scheme itself has no line in this request.
  3. Request line. Request line: GET /hello.txt. Application layer. Shown on laptop's eth0 as: Request line. The path from the URL follows GET, the action the client asks for.
  4. Host header. Host header: Host: web.lab.test. Application layer. Shown on laptop's eth0 as: Host header. The host also appears in a named line sent to the server.
  5. Status. Status: 200 OK. Application layer. Shown on laptop's eth0 as: Status. The server reports that the request succeeded.
  6. Content type. Content type: text/plain. Application layer. Shown on laptop's eth0 as: Content type. This named line tells curl what kind of content follows.
  7. Content. Content: Hello from web.. Application layer. Shown on laptop's eth0 as: Content. Curl prints the text that the server returned.
Check your answer

The scheme http chose plain HTTP and port 80. It has no line of its own inside this request.

Find GET /hello.txt HTTP/1.1. A method is the action the client asks the server to take. GET asks for the content at the path on that line. An HTTP header is a named line of the message. The Host: web.lab.test header tells the server which site the client asked for. Curl also lists an IPv6 address, a subject for IPv6 Foundations.

Read the response in the other direction. The status code is the number the server sends to report the result. In HTTP/1.0 200 OK, 200 means the request succeeded. The Content-type: text/plain header describes the kind of content. Then the content itself appears as Hello from web.

Curl writes its notes to a second output channel, and 2>&1 joins it to the normal output so grep can filter it. First ask for /nothing.txt and keep received lines with grep '^<'. Then specify a port in the URL and keep sent lines with grep '^>'.

Compare a missing file and a written port
learner@laptop:~$ curl -v http://web.lab.test/nothing.txt 2>&1 | grep '^<'< HTTP/1.0 404 File not found
< Server: netlab-web/1.0
< Date: Wed, 02 Dec 2026 16:58:25 GMT
< Connection: close
< Content-Type: text/html;charset=utf-8
< Content-Length: 335
< 
<!DOCTYPE HTML>
<html lang="en">
</html>learner@laptop:~$ curl -v http://web.lab.test:8080/hello.txt 2>&1 | grep '^>'> GET /hello.txt HTTP/1.1
> Host: web.lab.test:8080
> User-Agent: curl/8.5.0
> Accept: */*
> learner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.2), GNU Bash 5.2.21. Compare the missing file with the same successful file on port 8080.
Steps (6)
  1. Type curl -v http://web.lab.test/nothing.txt 2>&1 | grep '^<'
  2. Press Enter
  3. Output: < HTTP/1.0 404 File not found < Server: netlab-web/1.0 < Date: Wed, 02 Dec 2026 16:58:25 GMT < Connection: close < Content-Type: text/html;charset=utf-8 < Content-Length: 335 < <!DOCTYPE HTML> <html lang="en"> </html>
  4. Type curl -v http://web.lab.test:8080/hello.txt 2>&1 | grep '^>'
  5. Press Enter
  6. Output: > GET /hello.txt HTTP/1.1 > Host: web.lab.test:8080 > User-Agent: curl/8.5.0 > Accept: */* >
URL part Where it appears in the exchange
Scheme http Selects plain HTTP and the default port 80.
Host web.lab.test Curl’s lookup note and the Host: header.
Written port 8080 Selects the connection port and appears in Host: web.lab.test:8080.
Path /hello.txt The request line after GET.

“The URL is sent to the server as it is.” Compare the request line and the host header in the stage. They carry different parts of what you typed.

“A 404 means the server is down.” HTTP/1.0 404 File not found and Server: netlab-web/1.0 came from the server. It answered and reported that it could not find the path.

HTTP in Depth returns to methods, headers, cookies and caching.

On laptop, change the request on port 8080 to http://web.lab.test:8080/index.html. Write the request line and the host header you expect. Run the verbose request and compare the two lines. Which part changed when you selected a different file?

Solution

The new path changes the request line. The host header still includes the written port.

Check the request for the index file
learner@laptop:~$ curl -v http://web.lab.test:8080/index.html 2>&1 | grep '^>'> GET /index.html HTTP/1.1
> Host: web.lab.test:8080
> User-Agent: curl/8.5.0
> Accept: */*
> learner@laptop:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.2), GNU Bash 5.2.21. Compare your prediction with the request for the index file.
Steps (3)
  1. Type curl -v http://web.lab.test:8080/index.html 2>&1 | grep '^>'
  2. Press Enter
  3. Output: > GET /index.html HTTP/1.1 > Host: web.lab.test:8080 > User-Agent: curl/8.5.0 > Accept: */* >
  • Split the URL into the scheme, host, any written port, and path.
  • Read the method and headers in the request.
  • Use the response status to tell success from a missing file.

Next, Reading traffic that is not encrypted moves the observation point to the router.