HTTP & DNS

Basic Working Mechanisms of Web Protocols

HTTP & DNS (Quick Summary)

1. HTTP (HyperText Transfer Protocol)

Operates on L7 (Application Layer) and is the main protocol used on the World Wide Web in a Request-Response model.

  • Stateless: The server does not remember the state of the client from previous requests (hence Cookies or Tokens must be used for authentication).
  • HTTP Methods:
    • GET: Request data (Read)
    • POST: Send data to create something new (Create)
    • PUT/PATCH: Update data (Update)
    • DELETE: Delete data (Delete)
  • Main Status Codes:
    • 2xx: Success (e.g., 200 OK, 201 Created)
    • 3xx: Redirection (e.g., 301 Moved Permanently)
    • 4xx: Client Error (e.g., 400 Bad Request, 401 Unauthorized, 404 Not Found)
    • 5xx: Server Error (e.g., 500 Internal Server Error, 502 Bad Gateway)

2. DNS (Domain Name System)

The phonebook of the Internet.

  • Function: Translates Human-Readable Domains (e.g., google.com) into IP Addresses (e.g., 142.250.190.46) that computers use to communicate via L3 (Network Layer).
  • DNS Resolution Flow:
    1. Browser Cache (checks local machine first)
    2. OS Cache (hosts file)
    3. Router Cache
    4. ISP Recursive DNS Server
    5. Queries Root Server -> TLD Server (.com) -> Authoritative Server until the IP is returned

AI Knowledge Assistant

สวัสดีครับ! ผมคือ AI Assistant ประจำเว็บไซต์

คุณสามารถสอบถามข้อมูลด้าน Computer Science, Business, หรือ Finance ได้เลยครับ