---
title: "WWW; HTTP header and connection types"
subject: "Internet and Intranet"
chapter: 4
key: "semester_8/internet_and_intranet:www-http-header-connection"
source: https://www.bctengineer.com/q/semester_8/internet_and_intranet/www-http-header-connection
site: BCT Engineering
---

# WWW; HTTP header and connection types

Internet and Intranet · Chapter 4: HTTP and the Web Services

- Asked in: 2072 Magh, 2+8 marks
- Video: [HTTP Headers | Realtime example of HTTP Header | HTTP Response header | HTTP Request Header](https://www.youtube.com/watch?v=1KGXwxbp7wY) — Chirag Bhalodia
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/internet_and_intranet/www-http-header-connection
- Whole chapter: https://www.bctengineer.com/md/semester_8/internet_and_intranet/chapter-4

## Question

What is WWW? Define HTTP header with its connection type.

## Short answer

The World Wide Web is a distributed hypertext system using URLs and HTTP. HTTP headers are Name:value metadata lines. Connection types are non-persistent (Connection: close, one object per TCP) and persistent (Connection: keep-alive, multiple objects on one TCP, with optional pipelining).

## Answer

#### What is WWW?

The **World Wide Web (WWW)** is a distributed information system of linked hypertext documents and other resources, each identified by a **URL** and accessed over the Internet using **HTTP**. Documents are written in **HTML**, displayed by a **browser** (client) and stored on **web servers**. It was proposed by Tim Berners-Lee at CERN in 1989. The web is one service on the Internet; e-mail and FTP are others.

#### HTTP header

HTTP messages consist of a start line, **header lines**, a blank line, and an optional body. Headers are `Name: value` pairs giving extra information about the message, client, server or body.

**Request message**
```text
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
Accept-Language: en
Connection: keep-alive
If-Modified-Since: Wed, 9 Sep 2020 09:23:24
```

**Response message**
```text
HTTP/1.1 200 OK
Date: Thu, 8 Oct 2026 10:00:00 GMT
Server: Apache/2.4
Last-Modified: Wed, 9 Sep 2020 09:23:24
Content-Length: 6821
Content-Type: text/html
Connection: keep-alive
```

Common headers: `Host` (required in HTTP/1.1, supports virtual hosting), `User-Agent`, `Accept`, `Cookie` / `Set-Cookie`, `Content-Type`, `Content-Length`, `Cache-Control`, `Expires`, `Last-Modified`, `Location`.

#### Connection types (the Connection header)

1. **Non-persistent connection (HTTP/1.0).** Each object needs a new TCP connection, which the server closes after sending one object (`Connection: close`). Costs 2 RTT per object plus server overhead.
2. **Persistent connection (HTTP/1.1 default, `Connection: keep-alive`).** The connection stays open for further requests to the same server.
   - *Without pipelining:* next request after the previous response arrives (about 1 RTT per object).
   - *With pipelining:* the client sends many requests without waiting for replies (about 1 RTT total for all objects).

The connection stays open until a timeout, or until either side sends `Connection: close`.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the WWW?
   A. Another name for the Internet
   B. A distributed system of linked hypertext resources identified by URLs and accessed using HTTP
   C. A routing protocol
   D. An e-mail protocol
   Answer: B. The Web is one service on the Internet, using URLs, HTTP, HTML, browsers and web servers. (Key point: What WWW is)

2. What is the structure of an HTTP message?
   A. Body, then headers, then start line
   B. Start line, header lines, blank line, optional body
   C. Only headers
   D. Header lines then start line
   Answer: B. Headers are Name: value pairs placed after the start line and before a blank line and optional body. (Key point: HTTP message structure)

3. Why is the Host header important in HTTP/1.1?
   A. It is required and supports virtual hosting
   B. It sets the cookie
   C. It gives the content length
   D. It encrypts the request
   Answer: A. Host is required in HTTP/1.1 and lets one server host many sites by name. (Key point: Host header)

4. Which describes persistent connections with pipelining?
   A. New TCP connection per object, 2 RTT each
   B. Connection stays open and many requests are sent without waiting, about 1 RTT total
   C. Connection:close after each response
   D. UDP is used
   Answer: B. Persistent (keep-alive) is the HTTP/1.1 default; pipelining sends requests without waiting, while non-persistent costs 2 RTT per object. (Key point: Connection types)
