HTTP Basics1
HTTP Basics1
HTTP
HTTP is the foundation of data
communication on the World Wide Web,
defining how messages are formatted and
transmitted between web browsers and web
servers.
Key Characteristics
- Application-layer protocol
- Client-server communication model
- Foundation of data exchange on the
internet
Request-Response
Paradigm
Client (Web Browser) → Request →
Server
Client ← Response ← Server
Client Responsibilities
Initiate communication
Send well-formed HTTP requests
Specify desired resource and
action
Include necessary headers and
Request-Response
Paradigm
Server Responsibilities
- Listen for incoming requests
- Process requests
- Generate appropriate responses
- Return requested resources or error
messages
Request-Response
Paradigm
1. Cookies
Small text files stored on
client-side
Sent with each request
Maintain session information
State Management
Techniques
2. Session Tokens
Unique identifier for user
session
Typically passed in headers
or URLs
Server-side session tracking
State Management
Techniques
3. Local Storage
Client-side storage
mechanism
Persists between browser
sessions
Structure of HTTP
Messages
HTTP Request Message
METHOD /path-to-resource
HTTP/version-number Header-Name-1:
value
Header-Name-2: value
[ response body ]
Example
HTTP/1.1 200 OK
Content-Type:
text/html Content-
Length: 9934