Course: Intro to Web / Software Engineering
Topic: HTTP, Requests, Responses, and Browsers
Estimated Time: 45–60 minutes
Resources:
- MDN Web Docs, HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP - A modern browser
- Terminal access (macOS Terminal / Windows PowerShell / Linux shell)
Read:
MDN → Overview of HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
-
In your own words, what problem does HTTP solve?
Answer here: -
According to MDN, HTTP is described as:
- ☐ Stateful
- ☐ Stateless
What does this mean in practice?
Answer here: -
Fill in the blanks:
HTTP works as a – protocol, where a __________ sends a request and a __________ sends back a response.
MDN → HTTP Messages (Requests/Responses)
https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages
-
List three components of an HTTP request:
1. 2. 3. -
What is the purpose of an HTTP method?
Answer here: -
Match the method to its most common use:
Method Purpose GET POST PUT DELETE
MDN → HTTP Messages
https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages
-
What information does an HTTP status code communicate?
Answer here: -
Categorize the following status codes:
Status Code Category (2xx, 3xx, 4xx, 5xx) Meaning 200 301 404 500 -
Why is a 404 error considered a client-side error?
Answer here:
Task: Inspect a Real HTTP Request
- Open your browser
- Visit: https://example.org
- Open Developer Tools (Right click → Inspect)
- Go to the Network tab
- Reload the page
- How many total requests were made when the page loaded?
Answer here:
- Click on the HTML document request. Fill in:
| Field | Value |
|---|---|
| Request Method | |
| Status Code | |
| Content-Type |
- Name two headers sent by the browser:
1.
2.
- Name two headers sent by the server:
1.
2.
Goal: Make HTTP requests directly from the command line and interpret the response.
If
curlis not available on your machine, ask your instructor for an alternative (or use a campus lab machine).
Just use codespaces! macOS/Linux typically have it installed by default. Windows 10/11 usually includes it too.
Run:
curl https://google.com- What kind of content did you receive (HTML, JSON, something else)? How can you tell?
Answer here:
Run:
curl -I https://google.com- Record the status code line (the one that starts with
HTTP/):
Answer here:
- Record two response headers you see (write them exactly):
1.
2.
Run:
curl -I http://google.com- Do you see a redirect (e.g., 301/302)? If yes, what is the
Location:header pointing to?
Answer here:
Now run the same request but follow redirects:
curl -IL http://google.com- How many distinct HTTP status lines do you see now? (Count the
HTTP/...lines)
Answer here:
Run:
curl -I https://example.org
curl https://example.org- In your own words: what’s the difference between these two requests and their outputs?
Answer here:
MDN → HTTP Secure (HTTPS)
https://developer.mozilla.org/en-US/docs/Glossary/HTTPS
- What problem does HTTPS solve that HTTP does not?
Answer here:
- What role does encryption play in HTTPS?
Answer here:
- Before this lab, you may have thought a web page was “just HTML.”
After this lab, list three things that must happen before HTML appears on the screen.
1.
2.
3.
- All questions answered
- Developer Tools Data collected
-
curloutputs inspected (headers + redirects + HEAD vs GET) - Answerss
- Visit a different site (e.g.,
https://www.wikipedia.org) - Compare:
- Number of requests (DevTools)
- Status codes
- Resource types