/>

Lesson 11 — Intermediate

HTTP, DNS, HTTPS

Web ke core protocols — HTTP request/response, DNS domain se IP mapping, HTTPS secure communication. Har web developer ko ye pata hona chahiye.

⏱ 20 min• Intermediate• OSI basics

HTTP (HyperText Transfer Protocol)

# HTTP: Client-Server protocol
? Client (browser) request bhejta hai
? Server response bhejta hai
? Stateless protocol — har request independent

# Request Method:
GET — Data read karo (idempotent)
POST — Naya resource create karo
PUT — Resource update karo (full replacement)
PATCH — Resource partially update karo
DELETE — Resource delete karo

# Request Structure:
GET /api/users/123 HTTP/1.1
Host: api.example.com
Authorization: Bearer token123
Accept: application/json

# Response Structure:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 150

{"id": 123, "name": "Vaibhav"}

# Status Codes:
1xx: Informational (100 Continue)
2xx: Success (200 OK, 201 Created, 204 No Content)
3xx: Redirection (301 Moved, 302 Found, 304 Not Modified)
4xx: Client Error (400 Bad Request, 401 Unauthorized, 404 Not Found)
5xx: Server Error (500 Internal, 502 Bad Gateway, 503 Unavailable)
Mental Model: HTTP jaise restaurant order. Tum waiter ko order dete ho (request), waiter kitchen mein jaata hai, kuch der baad khana aata hai (response). Har order independent hai — waiter ko yaad nahi hota ki tumne kal kya order kiya tha (stateless).

DNS (Domain Name System)

# DNS: Domain Name — IP Address mapping
? google.com — 142.250.185.78
? Humans ko domain yaad rehta hai, computers ko IP

# DNS Resolution Steps:
1. Browser cache check — mila toh done
2. OS cache check — mila toh done
3. Router cache check — mila toh done
4. ISP DNS server — Still nahi mila?
5. Root DNS server — .com server batao
6. .com TLD server — google.com ka authoritative server
7. Authoritative server — IP address return karo
8. IP address browser ko mila — Connection establish!

# DNS Record Types:
A — Domain to IPv4 address
AAAA — Domain to IPv6 address
CNAME — Domain alias (www — example.com)
MX — Mail server
TXT — Text records (SPF, DKIM)
NS — Nameserver
PTR — Reverse lookup (IP to domain)

# DNS is UDP-based (port 53)
? Fast, lightweight
? TCP use jab response > 512 bytes ho

HTTPS (HTTP Secure)

# HTTPS = HTTP + SSL/TLS Encryption
? Data encrypted hota hai client-server ke beech
? Man-in-the-middle attack se protection

# SSL/TLS Handshake:
1. Client Hello: "Mujhe HTTPS chahiye, ye cipher suites support karte hain"
2. Server Hello: "Ye certificate hai, ye cipher suite select karo"
3. Client Verify: Certificate valid hai? (CA se verify)
4. Key Exchange: Session key banao (asymmetric se share karo)
5. Encrypted Communication: Symmetric encryption se data bhejo

# Certificate:
? Digital certificate jo server ki identity verify karta hai
? CA (Certificate Authority) issue karta hai
? Contains: Domain name, public key, expiry, CA signature

# Why HTTPS?
? Data encrypted — password, credit card safe
? Authentication — fake server se protection
? Data integrity — data tamper nahi hua
? SEO boost — Google HTTPS prefer karta hai

# HTTP vs HTTPS:
HTTP: Port 80, No encryption, Fast
HTTPS: Port 443, Encrypted, Slight overhead

Exercise

Question: DNS mein domain name ko IPv4 address se map karne wala record konsa hai? (1-2 words)

Question: HTTPS default port kya hai? (3 digits)

Common mistakes

Lesson complete?

HTTP, DNS, HTTPS samajh aa gaya? Ab Top 50 CS Questions practice karte hain — interview ready!

Popular courses: Data Science Course in Lucknow · AI Course in Lucknow · Python Course in Lucknow · Power BI Course · Data Analytics Course