So far, tools have written our requests for us. In this lesson, we'll see the messages themselves. HTTP/1.1 is a text protocol, so you can read them.
This lesson needs a terminal, because the runnable cells show only the response.
See the whole conversation
Run this in your terminal. The -v flag makes curl print the request as well as the response.
curl -v 'https://numbers.apps.pipal.in/add?a=3&b=4'
The output also has lines about the connection. Lines starting with > are what curl sent, and lines starting with < are what it received.
If your output shows HTTP/2, add --http1.1 to see the same messages in the older format. The messages have the same meaning in both versions.
The request
GET /add?a=3&b=4 HTTP/1.1
Host: numbers.apps.pipal.in
User-Agent: curl/7.81.0
Accept: */*
- The request line has the method, the path with the query, and the HTTP version.
- The headers come next, one per line, as
Name: value. - A blank line ends the headers.
- A body can follow. This request doesn't have one.
The Host header says which site the request is for, because one server can host many sites. It's required in HTTP/1.1.
The response
HTTP/1.1 200 OK
Server: nginx/1.24.0 (Ubuntu)
Date: Thu, 05 Nov 2026 01:31:20 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 2
Connection: keep-alive
7
- The status line has the HTTP version, the status code, and a short description.
- The headers come next, in the same format as before.
- A blank line ends the headers.
- The body comes last. Here, it's
7.
Content-Length: 2 counts the bytes in the body, which includes a line break after the 7.
Ask for only the headers
The HEAD method asks for the same response as GET, without the body. With curl, use -I.
Content-Length still says 2, even though no body came back. It describes the body that a GET would have returned.
Write a request by hand
nc (netcat) opens a connection and sends whatever you type. Run this in your terminal:
nc numbers.apps.pipal.in 80
Then type these lines, and press Enter twice at the end. You need to type them quickly, or the server may give up and close the connection.
GET /add?a=3&b=4 HTTP/1.1
Host: numbers.apps.pipal.in
Connection: close
The server replies with 301 Moved Permanently and a Location header. Port 80 is plain HTTP, and this server wants you to use HTTPS. That's still real HTTP: you wrote a request, and you got a response.
To use HTTPS, let openssl handle the encryption while you type the same request:
openssl s_client -quiet -connect numbers.apps.pipal.in:443
This time you get 200 OK and the answer.
Your turn: Remove the
Hostline and send the request again. What does the server say? Then ask for/fibs?n=5.
Summary
- HTTP messages have a first line, headers, a blank line, and an optional body.
- A request's first line has a method and a path. A response's first line has a status.
curl -vshows you the whole conversation.
Next, we'll use different methods to change data on a server.