HTTP Protocol
HTTP (HyperText Transfer Protocol) is the foundation of data communication on the World
Wide Web.
It is a client-server protocol where a client (such as a web browser) sends a request to a
web server, and the server responds with the requested resource.
These resources may include HTML pages, images, videos, or API responses.
HTTP works over TCP, typically using port 80. It is a stateless protocol, meaning that each
request is independent and the server does not remember previous requests.
To maintain session state, technologies such as cookies and sessions are used.
An HTTP message has two main parts: headers and body. The request includes a method
(GET, POST, PUT, DELETE), a URL, headers, and sometimes a body.
The server responds with a status code (such as 200 OK, 404 Not Found, or 500 Internal
Server Error), headers, and optional content.
Because HTTP is not encrypted, HTTPS was developed. HTTPS uses SSL/TLS encryption to
secure communication between client and server.
Today, most websites use HTTPS instead of plain HTTP for security reasons.
Review Questions
1. What is the main purpose of HTTP?
2. What does it mean that HTTP is stateless?
3. What is the difference between HTTP and HTTPS?