NOTE
2.6 HTTP
Historical HTTP overview covering messages, URLs, methods, status codes, versions, caching, cross-origin access, push, cookies, HTTPS, RESTful, and Fiddler.
This is a historical learning note and may contain outdated or incomplete understanding.
1. HTTP Message Format
1.1. Request
- Request line
- Request headers
- Blank line
- Request body
1.2. Response
- Status line
- Response headers
- Blank line
- Response body
2. URL
3. HTTP Methods
4. HTTP Status Codes
5. HTTP Versions
6. HTTP Cross-Origin Access
Browser Same-Origin Policy and Cross-Origin Access
7. HTTP Cache
8. HTTP Persistent Connections
9. HTTP Server Push
9.1. Client Polling
- The client sends an HTTP request to the server every 5 seconds. If the server has a new message, it returns it.
- Advantages:
- Simple to implement.
- Messages are not lost.
- Disadvantages:
- Messages are not timely.
- Repeatedly opening and closing connections consumes resources.
9.2. WebSocket
- WebSocket
- Advantages:
- Messages are timely.
- Disadvantages:
- Messages may be lost.
9.3. HTTP Long Polling
- The client sends an HTTP request. If the server has a new message, it returns immediately; otherwise, the server holds the connection and the client keeps waiting for the request to return.
- Advantages:
- Messages are timely.
- Disadvantages:
- Maintaining connections consumes server resources.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub