HTTP and TLS Fundamentals
Quick answer
HTTP defines application requests and responses. HTTPS wraps HTTP in TLS to protect the connection and authenticate the server according to certificate validation.
Prepare the practice environment
Run python3 lab-fixtures/networking/setup.py from the extracted package root as an ordinary user. Enter the printed private path and check pwd. Use a fresh fixture, Bash with LC_ALL=C and set -o pipefail. Python 3 is required for the fixed local socket helper. Use only loopback or synthetic data; never apply sample configuration. Manual examples require an authorized disposable VM.
How it works
A successful TCP connection may still receive HTTP 404 or 500. curl normally can complete successfully after an HTTP error response; --fail turns many HTTP error statuses into a nonzero exit. --max-time bounds total operation time and --connect-timeout bounds connection establishment. HTTPS validation checks trust and the requested hostname; an expired or mismatched certificate should be investigated, not bypassed. The supplied HTTP server is plain loopback HTTP, not evidence of TLS validation. wget can download responses to a specified path or stdout.
A diagnostic report should distinguish curl exit status from HTTP status. For instance, a loopback service can return 404 while curl exits successfully; using --fail can instead return a nonzero status. Neither result proves that a TLS certificate was checked when the URL uses plain HTTP. For HTTPS, keep the expected hostname and trust configuration intact.
Try the examples
The helper runs curl -q --noproxy '*' --max-time 3 --connect-timeout 1 -sS --fail URL against an ephemeral loopback HTTP server and checks its status. URL is supplied by the helper, not a literal destination. Read local_network.py to see how the port is allocated.
Expected stdout:
hello networkThe same server returns a deliberate 404; the helper compares curl statuses.
Expected stdout:
HTTP 404; default exit 0; --fail exit 22The helper calls wget --no-config --no-proxy --timeout=2 --tries=1 -q -O - URL with its generated loopback URL. The response is written to stdout and the server is shut down afterward.
Expected stdout:
hello networkCommon mistakes
Never bypass certificate checks as a routine fix. Do not equate HTTP status with a shell exit code.
Practice
Run the local HTTP examples; explain why curl --fail changes the exit status and why none verifies TLS.
Related references
Study: curl, wget. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTTP and TLS fundamentals — Knowledge Check
Apply network concepts to loopback, synthetic fixtures and VM-only scenarios.
HTTP 404 means what?
What does curl --fail do for typical 404?
What should you do for a hostname mismatch?
Which bounds total curl operation time?