Explain the HTTP protocol with request and response message formats and its advantages.

 

HTTP PROTOCOL — TOPICS & SUBTOPICS (NO THEORY)

1. Definition of HTTP


2. Features of HTTP

2.1 Connectionless Protocol

2.2 Media Independent

2.3 Stateless

2.4 Text-Oriented Protocol

2.5 Uses TCP (Port 80)

2.6 URL Support

2.7 Proxy and Caching Support


3. HTTP Message Structure

3.1 Start Line

3.2 Message Header

3.3 Message Body


4. HTTP Request Message Format

4.1 Request Line

4.1.1 Method

4.1.2 URL

4.1.3 Version

4.2 Request Headers

4.3 Request Body

4.4 Conditional Request


5. HTTP Request Methods

5.1 GET

5.2 HEAD

5.3 POST

5.4 PUT

5.5 DELETE

5.6 TRACE

5.7 OPTIONS


6. HTTP Response Message Format

6.1 Status Line

6.1.1 Version

6.1.2 Status Code

6.1.3 Status Phrase

6.2 Response Headers

6.3 Entity Headers

6.4 Response Body


7. HTTP Connections

7.1 Non-Persistent HTTP (HTTP 1.0)

7.1.1 One TCP Connection per Object

7.1.2 Two RTT

7.2 Persistent HTTP (HTTP 1.1)

7.2.1 Multiple Requests per Connection

7.2.2 One RTT

7.2.3 Pipelining


8. Advantages of HTTP

8.1 Simplicity

8.2 Scalability

8.3 Flexibility

8.4 Efficiency

8.5 Proxy Support

8.6 Caching Support

8.7 Reliability (TCP)


9. Diagram

9.1 Fig. 1.9.1 – HTTP Transaction



HTTP (HyperText Transfer Protocol) is a stateless request/response application-layer protocol used to define how client–server programs communicate to retrieve web pages from the World Wide Web. It uses TCP as its transport protocol, operates on port 80, transfers data in the form of plain text, hypertext, audio, video, and is a text-oriented protocol containing embedded URLs for accessing web resources.


HyperText Transfer Protocol (HTTP) is a stateless, request/response, Application Layer protocol used to retrieve Web pages from the World Wide Web. It supports transmission of plain text, hypertext, audio, video, and uses TCP (port 80) for reliable delivery. It is text-oriented and allows web browsers to communicate with web servers.


2. Characteristics and Features of HTTP


2.1 Connectionless Nature

A connection exists only during request–response. After server sends response, TCP connection is closed.

2.2 Stateless Communication

Each request is independent; server does not store client information between requests.

2.3 Media Independence

HTTP transfers any type of data as long as both client and server support correct MIME-type.

2.4 Text-Oriented Protocol

Commands and messages are in readable text format, easing debugging and application development.

2.5 Uses TCP for Reliable Transfer

Provides error-free, ordered delivery of web documents.

2.6 Supports URL-Based Resource Access

HTTP messages contain URL identifying file location on the server.

2.7 Supports Proxy, Caching, Pipelining

Proxy servers store frequently accessed pages → reduces latency and network traffic.


3. HTTP Message Structure

(General form)
START_LINE <CRLF>
MESSAGE_HEADER <CRLF>
<CRLF>
MESSAGE_BODY


4. HTTP REQUEST MESSAGE FORMAT


4.1 Components

  1. Request Line

  2. Request Headers

  3. Optional Body


4.2 Request Line

Contains three fields:

a. Method

Defines operation to be performed. Common methods from cn1.pdf:

  • GET – retrieves document

  • HEAD – fetches header only

  • POST – uploads/appends data

  • PUT – writes/replaces a file

  • DELETE – removes a resource

  • TRACE, OPTIONS

b. URL Field

Specifies location of resource on server.

c. HTTP Version

Defines protocol version (e.g., HTTP/1.1).


4.3 Request Headers

Headers provide client-side information such as:

  • Accepted file types

  • Host address

  • Preferred document format

  • Content length (for POST/PUT)

Each header follows:
Header-Name : Value


4.4 Message Body

Used only for POST or PUT to send form data, files, comments, etc.


5. HTTP RESPONSE MESSAGE FORMAT

(Expanded for exam detail)

5.1 Components

  1. Status Line

  2. Response Headers

  3. Body


5.2 Status Line

Contains:

  • HTTP Version

  • Status Code (e.g., 200, 404, 500)

  • Status Phrase (OK, Not Found, etc.)

Example:
HTTP/1.1 200 OK


5.3 Response Headers

Provide additional server information:

  • Server type

  • Last-Modified

  • Content-Type

  • Content-Length

  • Date
    Refer: Fig. 1.9.7 Response Message Header


5.4 Response Body

Contains actual web page (HTML), image, video, etc.
Present except when sending error-only messages.


6. Persistent vs Non-Persistent HTTP


6.1 Non-Persistent HTTP (HTTP 1.0)

  • One TCP connection per object

  • Requires 2 RTTs

  • Causes higher delay

  • Uses only GET, POST, HEAD

6.2 Persistent HTTP (HTTP 1.1)

  • Single TCP connection used for all objects

  • Uses 1 RTT

  • Supports pipeline requests

  • Saves time, memory, CPU

  • Reduces network congestion


7. Advantages of HTTP


7.1 Easy, Simple and Flexible Protocol

Text-based, easy to implement and troubleshoot.

7.2 Independent of Data Type (Media Independent)

Can send images, audio, video, HTML, JSON, etc.

7.3 Stateless Nature Improves Server Scalability

Servers do not maintain sessions → faster response.

7.4 Efficient Through Persistent Connections

  • One TCP connection for multiple requests

  • Reduces RTT and overhead

  • Less packet generation → less congestion

7.5 Supports Proxy Servers and Caching

  • Reduces load on origin server

  • Speeds up repeated requests

  • Decreases network traffic

7.6 Supports Multiple Request Methods

GET, POST, PUT, DELETE, making it suitable for modern web applications.

7.7 Reliable Transmission Using TCP

Ensures error-free, ordered delivery of content.


8. Diagram (Figure Number Only)

HTTP Transaction – Fig. 1.9.1