In part 3 the connection is open. Inside it travel lines of text, for a web page, an API call or a payment. We can type a request by hand, and the server answers in the same plain way.
In the post office picture, the open connection is the registered envelope, and HTTP is the letter inside. HTTP says what the letter looks like: a first line with the request, a few lines of notes, and then the content.
A request is a few lines
Send a request without a browser. Port 80 is the default port for plain HTTP, and printf writes the lines for us:
docker run --rm alpine sh -c 'apk add -q netcat-openbsd &&
printf "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" |
nc example.com 80 | head -6' HTTP/1.1 200 OK Date: Sun, 18 Oct 2026 17:48:13 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: close Server: cloudflare
Here is what each marked part does:
- 1
printf "GET / HTTP/1.1\r\n..."writes the request.\r\nis the line break that HTTP uses. - 2
| nc example.com 80sends the text to port 80 and prints the answer. - 3
head -6keeps the first six lines.
We sent three lines and an empty line. The first line has three parts: the method GET (give me this), the path /, and the version. Host names the site, because one machine can serve many names. Connection: close asks the server to close the connection after the answer. The empty line ends the notes, which are called headers. The server answered with a status line, 200 OK. Here 200 is the status code. The server then sent its own headers and the content. We cut them off with head.
curl shows both sides
curl -v prints each line it sends with a > and each line it receives with a <:
docker run --rm alpine sh -c 'apk add -q curl &&
curl -sv http://example.com -o /dev/null 2>&1 | grep -E "^[<>]" | head -11'> GET / HTTP/1.1 > Host: example.com > User-Agent: curl/8.22.0 > Accept: */* > < HTTP/1.1 200 OK < Date: Sun, 18 Oct 2026 17:48:13 GMT < Content-Type: text/html; charset=utf-8 < Transfer-Encoding: chunked < Connection: keep-alive < Server: cloudflare
Here is what each marked part does:
- 1
curl -sv URLprints the request and the answer. The option-shides the progress meter, and-vshows the lines. - 2
-o /dev/nullthrows the page away.2>&1joins the messages into the output so thatgrepcan read them. - 3
grep -E "^[<>]"keeps the lines that start with<or>.
This is our request again, with two notes that curl added: who is asking (User-Agent) and what it accepts (Accept). The answer differs in one place: Connection: keep-alive. The server offers to keep the connection open, and the next section uses that. If a proxy adds a header or a server sends a wrong Content-Type, the line appears in this output.
One connection, many requests
Opening a connection takes three packets, and the padlock in part 5 adds more. A client therefore reuses a connection for the next request. Ask for the same page twice in one curl command:
docker run --rm alpine sh -c 'apk add -q curl &&
curl -sv http://example.com http://example.com -o /dev/null -o /dev/null 2>&1 |
grep -E "^\* (Established|Reusing)"' * Established connection to example.com (104.20.23.154 port 80) from 172.17.0.2 port 53340 * Reusing existing http: connection with host example.com
Here is what each marked part does:
- 1Two URLs in one
curlcommand make two requests. The two-o /dev/nulloptions throw both pages away. - 2
grep -E "^\* (Established|Reusing)"keeps the connection messages thatcurlprints.
The connection opened once, and the second request used it. On one HTTP/1.1 connection, the requests go one after another. If the first answer is slow, the second waits behind it. For this reason a browser often opens several connections to the same server.
The versions change how many fit at once
The newer versions of HTTP keep the same methods, paths, notes and status codes. They change how the lines travel. HTTP/2 sends many requests at the same time over one connection, each as a numbered stream, so a slow answer does not block the others. HTTP/3 keeps this idea but runs over UDP instead of TCP, so one lost packet stops fewer streams. The client and the server agree on the version while they open the connection. We can ask for each version:
docker run --rm alpine sh -c 'apk add -q curl &&
curl -s --http1.1 -o /dev/null -w "%{http_version}\n" https://example.com &&
curl -s --http2 -o /dev/null -w "%{http_version}\n" https://example.com'1.1 2
Here is what each marked part does:
- 1
--http1.1and--http2choose the version. - 2
-w "%{http_version}\n"prints the version that was really used.
The same server answered both. In HTTP/2 the status line reads HTTP/2 200 instead of HTTP/1.1 200 OK. The notes and the status mean the same, but they travel in a compact binary form. The server also sends a header named alt-svc: h3=":443", which tells clients that HTTP/3 is available on port 443.
Key points
- An HTTP request is a first line, a few notes called headers, an empty line, and then the content.
- The server answers with a status line, headers, an empty line and the content.
curl -vshows each line:>for what we send and<for what we receive.- A client reuses one connection for several requests, because opening a connection takes time.
- HTTP/1.1, HTTP/2 and HTTP/3 use the same methods and status codes. They differ in how many requests share one connection.
Next, in part 5: what the padlock in the address bar proves, and what it does not.