URLs and HTTP messages
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.
Before you start
Section titled “Before you start”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.
Update the lab tool
Section titled “Update the lab tool”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.
wget https://rootvolt.dev/downloads/netlab-1.2.tar.gzwget https://rootvolt.dev/downloads/netlab-1.2.tar.gz.sha256sha256sum -c netlab-1.2.tar.gz.sha256tar -xzf netlab-1.2.tar.gzsudo sh netlab-1.2/install.shnetlab resetVersion 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.
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:~$ Steps (9)
- Type
netlab version - Press Enter
- Output:
netlab 1.2 (cast fffd977692d0) - Type
netlab reset - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Output:
Lab is back in its starting state (modes on: dns).
Split the web address
Section titled “Split the web address”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.
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.
Read the lines that go out and come back
Section titled “Read the lines that go out and come back”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?
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:~$ Steps (3)
- Type
curl -v http://web.lab.test/hello.txt - Press Enter
- 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.GET /hello.txtHost: web.lab.test200 OKtext/plainHello from web.Reading the output
Pick a step to match a marked part of the output to the picture.
Steps (7)
- Lookup. Lookup: web.lab.test. Shown on laptop's eth0 as: laptop. The host in the URL tells curl which name to look up.
- 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.
- 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.
- 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.
- Status. Status: 200 OK. Application layer. Shown on laptop's eth0 as: Status. The server reports that the request succeeded.
- 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.
- 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.
Ask for a missing file
Section titled “Ask for a missing file”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 '^>'.
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:~$ Steps (6)
- Type
curl -v http://web.lab.test/nothing.txt 2>&1 | grep '^<' - Press Enter
- 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> - Type
curl -v http://web.lab.test:8080/hello.txt 2>&1 | grep '^>' - Press Enter
- 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. |
Mistakes to recognize
Section titled “Mistakes to recognize”“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.
Good to know
Section titled “Good to know”HTTP in Depth returns to methods, headers, cookies and caching.
Try it yourself
Section titled “Try it yourself”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.
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:~$ Steps (3)
- Type
curl -v http://web.lab.test:8080/index.html 2>&1 | grep '^>' - Press Enter
- 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.