# HTTP, HTTPS and DNS — Methods, Status Codes, Cookies and Name Resolution

Source: https://skills101.in/learn/computer-networks/http-https-and-dns — Skills101 free tutorial (Computer Networks). Updated 2026-11-09.

Every time you open a website or an app loads data, **HTTP** carries the request and response, **DNS** finds the server, and **HTTPS** keeps it private.

## Part A — HTTP

![An HTTP request (GET /learn, Host: skills101.in, headers) and the response (HTTP/1.1 200 OK, Content-Type, the HTML body), plus the main methods and status code groups](https://skills101.in/learn-img/computer-networks/http-exchange.svg)

HTTP is a **request–response** protocol. The client (browser, app) sends a request; the server sends one response.

### Methods

| Method | Meaning | Example |
|---|---|---|
| **GET** | read data | load a course page |
| **POST** | create / submit | sign up, submit code |
| **PUT** | replace | update a whole profile |
| **PATCH** | change part | update only the phone number |
| **DELETE** | remove | delete a comment |

**GET vs POST (interview favourite):** GET sends data in the URL (visible, cached, bookmarkable, should not change anything); POST sends data in the body (for creating/changing data, not cached).

### Status codes

| Range | Meaning | Common ones |
|---|---|---|
| **2xx** | success | 200 OK, 201 Created, 204 No Content |
| **3xx** | redirect | 301 Moved Permanently, 302 Found, 304 Not Modified |
| **4xx** | client error | 400 Bad Request, 401 Unauthorized (not logged in), 403 Forbidden (not allowed), 404 Not Found, 429 Too Many Requests |
| **5xx** | server error | 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable |

### Stateless + cookies

HTTP is **stateless** — each request is independent. To remember you between requests, servers use **cookies**: the server sends `Set-Cookie: session=abc123`, and the browser sends `Cookie: session=abc123` with every later request. That's how you stay logged in.

## Part B — HTTPS

**HTTPS = HTTP over TLS**. TLS gives three things:

1. **Encryption** — nobody on the Wi-Fi can read your password.
2. **Integrity** — data can't be changed in transit.
3. **Authentication** — the **certificate** proves you're really talking to skills101.in (signed by a trusted Certificate Authority).

During the **TLS handshake**, the browser checks the certificate, and both sides agree on a shared secret key using **asymmetric** (public-key) cryptography; the actual data is then encrypted with fast **symmetric** encryption.

## Part C — DNS

People remember names; computers need IP addresses. **DNS** (Domain Name System) is the internet's phone book.

![The browser asks a resolver; the resolver asks a root server, then the .in TLD server, then skills101.in's name server, which returns the IP address](https://skills101.in/learn-img/computer-networks/dns.svg)

1. The browser checks its **cache** (and the OS cache).
2. If not found, it asks a **recursive resolver** (your ISP's or 8.8.8.8).
3. The resolver asks a **root server** → "ask the **.in** servers".
4. The **TLD server** → "ask **skills101.in**'s authoritative name server".
5. The **authoritative server** returns the IP address.
6. The answer is **cached** for its **TTL**, so next time it's instant.

### Common DNS records

| Record | Maps | Example |
|---|---|---|
| **A** | name → IPv4 | skills101.in → 203.0.113.7 |
| **AAAA** | name → IPv6 | |
| **CNAME** | name → another name | www → skills101.in |
| **MX** | domain → mail server | |
| **TXT** | text (verification, SPF) | Google site verification |

## Common mistakes

- Saying 401 and 403 are the same: 401 = not logged in; 403 = logged in but not allowed.
- Thinking HTTPS hides which **site** you visit — it hides the content, but the domain is still visible to DNS/your ISP.
- Using GET for actions that change data.

## Quick recap

- HTTP: request–response, stateless; methods GET/POST/PUT/PATCH/DELETE; status 2xx/3xx/4xx/5xx.
- Cookies keep sessions across stateless requests.
- HTTPS = HTTP + TLS: encryption, integrity, authentication via certificates.
- DNS: browser cache → resolver → root → TLD → authoritative → IP, cached by TTL.


Practice quiz and free certificate: https://skills101.in/learn/computer-networks/http-https-and-dns