- 2073 Magh · 3+3+4 marks
HTTP working, methods, virtual hosting
Short answer
HTTP is a request-response protocol over TCP; browser requests resources, server returns status and content. Methods include GET, POST, HEAD. Virtual hosting runs multiple sites on one server via IP-based, port-based, or name-based selection.
How HTTP works? Explain different methods of HTTP. Write the concept of virtual hosting.
How HTTP works
HyperText Transfer Protocol (HTTP) is the application layer protocol of the Web. It uses a client/server request-response model over TCP (port 80; HTTPS 443). It is stateless: the server keeps no memory of earlier requests.
- The user types a URL, e.g.
http://www.example.com/index.html. - The browser asks DNS for the IP address of
www.example.com. - The browser opens a TCP connection to port 80 of the server.
- It sends an HTTP request message (request line, headers, blank line, optional body).
- The server finds the object and sends a response (status line such as
200 OK, headers, body). - The browser parses the HTML; for each embedded object (image, CSS) it sends further requests.
- The connection is closed (HTTP/1.0) or kept alive (HTTP/1.1 persistent).
Browser Web server
|--- TCP connect ----------->|
|--- GET /index.html ------->|
|<-- 200 OK + HTML ----------|
|--- GET /logo.png --------->|
|<-- 200 OK + image ---------|
HTTP methods
- GET: retrieve a resource.
- POST: send form data in the body for processing.
- HEAD: headers only, no body.
- PUT: upload or replace a resource.
- DELETE: remove a resource.
- OPTIONS and TRACE: query the server's capabilities, and echo the request back for testing.
Virtual hosting
Virtual hosting runs several web sites on one server machine, saving hardware and IP addresses. Types: IP-based (a different IP per site), port-based (a different port per site) and name-based (same IP; the Host: header selects the site). Example: www.a.com and www.b.com both at 192.168.1.10, each with its own <VirtualHost> and DocumentRoot in Apache.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- HTTP request methods; web server and virtual hosting · Internet and Intranet, chapter 4
- Virtual hosting and HTTP connections · Internet and Intranet, chapter 4
- Virtual hosting types; name-based steps · Internet and Intranet, chapter 4 · asked 2×
- Short note: Web virtual hosting · Internet and Intranet, chapter 4 · asked 2×