HTTP/HTTPS
HTTP (HyperText Transfer Protocol) is the fundamental protocol of the web. HTTPS is its secure version.
01What is HTTP?
HTTP enables data exchange between client (browser) and server.
Request-Response Model:
code
Browser → HTTP Request → Server
Browser ← HTTP Response ← Server
02HTTP Methods
| Method | Usage | Example |
|---|---|---|
| GET | Get data | Viewing a page |
| POST | Send data | Submitting a form |
| PUT | Update | Editing profile |
| DELETE | Delete | Deleting account |
| HEAD | Headers only | File size check |
03HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Successful |
| 301 | Moved | Permanent redirect |
| 302 | Found | Temporary redirect |
| 400 | Bad Request | Invalid request |
| 401 | Unauthorized | Authentication required |
| 403 | Forbidden | Access denied |
| 404 | Not Found | Page not found |
| 500 | Server Error | Server error |
04HTTPS = HTTP + SSL/TLS
HTTPS is the encrypted version of HTTP.
Differences:
| HTTP | HTTPS |
|---|---|
| Port 80 | Port 443 |
| Unencrypted | Encrypted |
| http:// | https:// |
| Fast | Slightly slower |
05Summary
- HTTP = Web protocol
- HTTPS = Secure HTTP
- GET = Get data, POST = Send data
- 200 = OK, 404 = Not Found, 500 = Error