What is HTTP?
HTTP (Hypertext Transfer Protocol) is the foundation protocol of the World Wide Web, defining how messages are formatted and transmitted between web browsers and servers. It is a stateless, application-layer protocol that enables the retrieval of linked resources.
Quick Facts
| Full Name | Hypertext Transfer Protocol |
|---|---|
| Created | 1991 by Tim Berners-Lee |
| Specification | Official Specification |
How HTTP Works
HTTP was developed by Tim Berners-Lee at CERN starting in 1989. It operates as a request-response protocol: clients send requests to servers, which respond with the requested resources. HTTP/1.1 (1997) added persistent connections and chunked transfers. HTTP/2 (2015) introduced multiplexing and header compression. HTTP/3 (2022) uses QUIC protocol for improved performance. HTTP methods include GET, POST, PUT, DELETE, PATCH, HEAD, and OPTIONS. The protocol is text-based and human-readable, making it easy to debug.
Key Characteristics
- Request-response protocol model
- Stateless - no connection state between requests
- Text-based and human-readable
- Supports multiple methods (GET, POST, PUT, DELETE)
- Headers carry metadata about requests/responses
- Versions: HTTP/1.1, HTTP/2, HTTP/3
Common Use Cases
- Web page retrieval
- API communication
- File downloads and uploads
- Form submissions
- Streaming media delivery
Example
HTTP Request:
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
Accept-Language: en-US
Connection: keep-alive
HTTP Response:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 1234
Date: Mon, 01 Jan 2024 00:00:00 GMT
Server: Apache/2.4
<!DOCTYPE html>
<html>...</html>
Common HTTP Methods:
GET - Retrieve resource
POST - Submit data
PUT - Replace resource
PATCH - Partial update
DELETE - Remove resource
HEAD - Get headers only
OPTIONS - Get supported methods