Skip to main content
HTTP/HTTPS Requests, Methods & TLS Overview
Lesson 6 of 11

HTTP/HTTPS Requests, Methods & TLS Overview

Learn the structure of HTTP requests, methods, headers and status codes, how TLS 1.3 secures HTTPS traffic, and how to craft custom requests with curl and inspect certificates with openssl.

Beginner 22 min Networking
Authorised environments only — The techniques described here are used only in training labs and on systems you own or have written permission to test.

Learning objectives

  • Break down the components of an HTTP/1.1 request and response including methods, headers and status codes
  • Select and craft custom HTTP methods and request headers using curl
  • Explain how TLS 1.3 provides confidentiality, integrity and server authentication for HTTPS
  • Inspect live TLS certificates and protocol negotiation using openssl s_client

Recommended first: TCP, UDP, Ports & ICMP DiagnosticsDNS Resolution & DHCP Lease Mechanics

#Why this matters

Web applications, REST APIs and cloud consoles run over HTTP or HTTPS. Browsers hide the underlying protocol behind rendered pages, limiting casual use to clicks and standard forms.

When debugging APIs, inspecting web logs or solving entry-level veb-tahlil challenges, you need to craft raw HTTP directly. Servers often branch on the HTTP method (GET versus PUT or OPTIONS) or require custom headers. Understanding how TLS 1.3 protects HTTPS also helps you catch downgrade risks, invalid certificates and unsafe header trust.

#Anatomy of an HTTP request and response

HTTP is a stateless application-layer request-response protocol. Plain HTTP uses TCP port 80 and HTTPS uses TCP port 443 (HTTP/3 uses QUIC over UDP/443). An HTTP/1.1 message has a start line, headers, a blank line (CRLF) and an optional body:

http
POST /api/login HTTP/1.1
Host: lab.local
Content-Type: application/json
X-Lab-Client: student
Content-Length: 27

{"username":"alice","ok":1}

The server answers with a status line, headers, a blank line and an optional body:

http
HTTP/1.1 200 OK
Content-Type: application/json
Set-Cookie: session=abc123; HttpOnly; Secure
Content-Length: 19

{"status":"active"}

In HTTP/1.1, the Host header is mandatory so one IP can serve multiple domains (virtual hosting). Status codes group outcomes by first digit:

Range Class Common examples
2xx Success 200 OK, 201 Created, 204 No Content
3xx Redirection 301 Moved Permanently, 302 Found (Location header)
4xx Client error 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 405 Method Not Allowed
5xx Server error 500 Internal Server Error, 502 Bad Gateway

A 405 Method Not Allowed response often includes an Allow header listing accepted methods.

#HTTP methods and why they matter

HTML forms send only GET or POST, but HTTP defines several verbs with distinct roles:

Method Body Intended meaning Web analysis notes
GET No Retrieve a resource Parameters sit in the URL query string
HEAD No Headers only Checks status or Content-Length
POST Yes Submit data or action Carries form or JSON payloads
PUT Yes Create or replace resource Common in APIs and method gates
DELETE Optional Remove a resource Usually restricted to privileged roles
OPTIONS No Query allowed methods May return Allow: GET, PUT, OPTIONS

Because headers (User-Agent, Referer, X-Forwarded-For, custom X-*) are client-supplied text, any header can be forged unless a trusted proxy overwrites it.

#How HTTPS adds TLS 1.3 protection

Plain HTTP exposes URLs, cookies and credentials in cleartext. HTTPS wraps HTTP inside TLS 1.3 (RFC 8446), which replaces deprecated SSLv3, TLS 1.0 and TLS 1.1 and completes key exchange in one round trip (1-RTT). TLS provides:

  1. Confidentiality: AEAD encryption hides paths, headers and payloads.
  2. Integrity: Authentication tags detect tampering in transit.
  3. Authentication: The server presents a CA-signed X.509 certificate and proves key ownership.
TLS 1.3 handshake before encrypted HTTP exchangeTLS 1.3 handshake before encrypted HTTP exchangeClientServerClientHello (TLS 1.3, SNI=lab.local, key_share)ServerHello + EncryptedExtensions + Certificate + CertificateVerify + FinishedFinished + Encrypted HTTP GET /Encrypted HTTP/1.1 200 OKCertificate authenticates server; SNI remains visible in ClientHello

Because SNI (Server Name Indication) sits in the unencrypted ClientHello, observers still see the target hostname while paths, headers and bodies stay hidden.

#Inspecting HTTP and TLS from the terminal

In curl, -i prints response headers, -v shows full request/response details, -X sets the method and -H adds a header. With openssl, s_client inspects certificates and negotiated TLS parameters.

Probing an HTTP endpoint and checking TLS with openssl
$ curl -i -X OPTIONS http://lab.local:8080/gate
HTTP/1.1 204 No Content
Allow: OPTIONS, PUT

$ curl -i -X PUT -H "X-Lab-Client: student" http://lab.local:8080/gate
HTTP/1.1 200 OK
Content-Type: text/plain

Access granted: lab_token_verified

$ openssl s_client -connect lab.local:443 -servername lab.local </dev/null 2>/dev/null | grep -E "Protocol|Cipher|subject="
subject=CN = lab.local
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Protocol  : TLSv1.3

#Defending and common mistakes

  • Allowing plaintext HTTP: Redirect port 80 to HTTPS and send Strict-Transport-Security (HSTS).
  • Using curl -k in automation: Disabling certificate checks invites active man-in-the-middle interception.
  • Trusting client headers for auth: Never base access control on User-Agent, Referer or unvalidated X-Forwarded-For.
  • Leaving legacy TLS active: Disable SSLv3, TLS 1.0 and TLS 1.1; require TLS 1.2+ AEAD or TLS 1.3.

#Summary

  • HTTP/1.1 pairs a method, path, headers (including Host) and body with 2xx-5xx status responses.
  • Beyond GET and POST, verbs like PUT, DELETE and OPTIONS are vital for APIs and veb-tahlil tasks.
  • HTTPS uses TLS 1.3 for confidentiality, integrity and X.509 authentication in 1-RTT.
  • curl (-i, -v, -X, -H) and openssl s_client inspect methods, headers and TLS state directly.

Knowledge check

Sign in to take the test, complete lessons and save your progress. Log in

Practice: test your knowledge