The World Wide Web (WWW) is a distributed client-server architecture designed to share information across global networks. It relies on standardized protocols and document structures to seamlessly retrieve and display hypertext, hypermedia, and structured data.
The modern WWW operates on a distributed client-server model. Rather than keeping all documents in a single centralized repository, the service is spread across thousands of physical locations called sites.
A Web page can exist in one of two configurations:
Simple Page Retrieval:
Client Server (Site A)
| --- Request 1 ---------> | (Get Biography)
| <--- Response 1 -------- | (Returns Document with inline assets)
Composite Page Retrieval:
Client Server (Site A) Server (Site B)
| --- Request 1 ---------> | (Get Main File A)
| <--- Response 1 -------- | (Returns File A with pointers to B & C)
| --- Request 2 ---------> | (Get Image B)
| <--- Response 2 -------- | (Returns Image B)
| --- Request 3 ------------------------------------> | (Get Text C)
| <--- Response 3 ---------------------------------- | (Returns Text C)Each referenced file (such as File A, File B, or File C) remains a fully independent resource with its own unique identifier and access permissions, meaning any of them can also be retrieved directly on its own.
The client application, known as a Web Browser, is responsible for presenting web documents to the user. A browser typically contains three main logical components:
+-----------------------------------------------------+
| BROWSER |
| +-----------------------------------------------+ |
| | Controller | |
| +----------------------+------------------------+ |
| | |
| +-----------------+-----------------+ |
| | | |
| +----+---------+ +-----+-----+ |
| | Protocols | |Interpreters| |
| | (HTTP, SMTP) | | (HTML, JS) | |
| +--------------+ +-----------+ |
+-----------------------------------------------------+To access any resource across the distributed network, the client needs a standardized identifier. The Uniform Resource Locator (URL) specifies the protocol, host machine, optional port number, and the precise path to the resource:
http, https, ftp).Web documents are categorized based on when their content is determined:
Web Documents
|
+-----------------------+-----------------------+
| | |
Static Dynamic Active
(Pre-created, (Server-side (Client-side
fixed files) computation) computation)Server-Side Dynamic Document Execution (CGI / Scripting):
Client Web Server Script Engine / DB
| --- HTTP Request ------> | |
| | --- Executes Script ------> |
| | <--- Returns HTML/Data ---- |
| <--- HTTP Response ----- | |The Hypertext Transfer Protocol (HTTP) is an application-layer protocol designed to transfer hypermedia resources across the Internet.
HTTP Request Message Format:
+--------------------------------------------------------------+
| Request Line: [Method] [SP] [Request-URI] [SP] [Version] |
+--------------------------------------------------------------+
| Header Lines: [Field Name] : [Value] |
| ... |
+--------------------------------------------------------------+
| Blank Line: CRLF |
+--------------------------------------------------------------+
| Entity Body: [Optional Request Payload Data] |
+--------------------------------------------------------------+
HTTP Response Message Format:
+--------------------------------------------------------------+
| Status Line: [Version] [SP] [Status Code] [SP] [Phrase] |
+--------------------------------------------------------------+
| Header Lines: [Field Name] : [Value] |
| ... |
+--------------------------------------------------------------+
| Blank Line: CRLF |
+--------------------------------------------------------------+
| Entity Body: [Response Resource Data] |
+--------------------------------------------------------------+The request line specifies an action to perform on the target resource. Common methods include:
| Method | Description |
| :--- | :--- |
| GET | Retrieves the resource identified by the URI. |
| POST | Submits data (often from forms) to be processed by the identified resource. |
| PUT | Uploads the enclosed entity, replacing any existing resource at the target URI. |
| DELETE | Deletes the resource identified by the URI. |
| HEAD | Retrieves only the headers of a resource (identical to GET, but without the response body). |
A client wants to retrieve a JPEG image located at /assets/logo.png.
Request Message:
GET /assets/logo.png HTTP/1.1
Host: www.kophub.com
User-Agent: Mozilla/5.0
Accept: image/png, image/jpeg
Connection: close
Note the empty line separating the headers from the body. Since this is a GET request, there is no body payload.
Response Message:
HTTP/1.1 200 OK
Date: Wed, 15 Jul 2026 14:00:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Type: image/png
Content-Length: 4812
Connection: close
[Raw Binary Image Data Contents Here]A client submits dynamic form data to a CGI script /bin/register.pl.
Request Message:
POST /bin/register.pl HTTP/1.1
Host: www.kophub.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 31
username=kophub&user_id=10243How TCP connections are managed has a significant impact on network performance and latency.
In a non-persistent connection, one TCP connection is opened for every single HTTP request/response transaction. Once the server sends the requested object, it closes the connection.
Let RTT (Round-Trip Time) be the time it takes for a small packet to travel from client to server and back.
For a base HTML document with embedded media files:
This approach introduces significant overhead due to repeated TCP handshakes and slow-start warmups.
Non-Persistent Connection Timeline:
Client Server
| ------------ TCP SYN --------------------> | \
| <----------- TCP SYN-ACK ----------------- | |-- RTT 1 (TCP Handshake)
| ------------ HTTP GET (ACK) -------------> | /
| <----------- HTTP Response (Data) -------- | -- RTT 2 (HTTP Transfer)
X (Connection Closed by Server)A persistent connection keeps the TCP connection open after sending a response. Subsequent requests can reuse this existing path, avoiding repeated TCP handshakes.
Persistent Connection (Without Pipelining):
Client Server
| ------------ TCP SYN --------------------> | \
| <----------- TCP SYN-ACK ----------------- | |-- RTT 1 (TCP Handshake)
| ------------ HTTP GET 1 (HTML) -----------> | /
| <----------- HTTP Response 1 ------------- | -- RTT 2 (HTML Delivered)
| ------------ HTTP GET 2 (Image) ----------> | \
| <----------- HTTP Response 2 ------------- | |-- RTT 3 (Image Delivered)
| (Connection Kept Alive for future requests)HTTP is inherently stateless, but modern applications need to track user state (e.g., login status, shopping carts). Cookies solve this problem by managing state at the application layer.
Set-Cookie header in its response.Cookie header.Cookie Transaction Flow:
Client Server
| --- GET /index.html -----------------------> |
| | * Generates ID: 88712
| <-- HTTP 200 OK (Set-Cookie: ID=88712) ----- | * Stores ID in DB
| |
| * Stores Cookie Locally |
| |
| --- GET /cart.html (Cookie: ID=88712) -----> |
| | * Matches ID 88712
| <-- HTTP 200 OK (Personalized Cart Page) --- | * Updates Session StateA Proxy Server (Web Cache) is an intermediary entity that satisfies HTTP requests on behalf of an origin web server.
+--------------+
| Client |
+------+-------+
| HTTP Request (GET /logo.png)
v
+--------------+ [Cache Hit] Returns local copy
| Proxy Server | ------------+
+------+-------+ |
| v
| [Cache Miss]
| HTTP Request
v
+--------------+
| Origin |
| Server |
+--------------+To prevent proxies or client caches from serving outdated information without unnecessarily re-fetching intact data, HTTP uses Conditional Requests:
If-Modified-Since header, specifying the timestamp of its currently cached version.304 Not Modified status code. The client then safely uses its cached copy.200 OK status code.If-Modified-Since) optimize bandwidth by avoiding redundant resource downloads.A distributed client-server architecture where clients (browsers) request resources from servers located across distinct physical sites using Uniform Resource Locators (URLs).
Web resources classified into static (pre-created), dynamic (generated on-the-fly at the server-side), and active (executed on the client-side browser).
Stateless request-response exchanges using ASCII-encoded commands carried over TCP (port 80) to transfer hypertext, media, and raw data.
The mechanical distinction between non-persistent HTTP (one TCP connection per resource) and persistent HTTP (multiple resource transfers over a single, sustained TCP connection).
Mechanisms used to introduce stateful sessions over the inherently stateless HTTP protocol using client-side cookie headers.
Test your understanding with 5 questions
A client browser requests an HTML page containing exactly 4 embedded JPEG images from a web server. If non-persistent HTTP without parallel connections is used, how many total TCP connection handshakes are initiated to render the complete page?
Which of the following architectural models correctly distinguishes dynamic web documents from active web documents?
Suppose a browser sends an HTTP request containing the header 'If-Modified-Since: Mon, 14 Jul 2026 12:00:00 GMT'. If the requested resource has NOT been updated since that time, what status code and message body does the server return?
How does HTTP's structural connection design compare to File Transfer Protocol (FTP) and Simple Mail Transfer Protocol (SMTP)?
A client-side browser visits 'BestToys.com'. The server issues a response header 'Set-Cookie: 12343'. During a subsequent request to retrieve an image from the same server, what action does the client browser take?
6 Modules
6 Modules