Open xxleyi opened 5 years ago
Client: the user-agent
: The browser is always the entity initiating the request.
The Web server
: A server presents only as a single machine virtually. With HTTP/1.1 and the Host
header, they may even share the same IP address.
Proxies
:
HTTP is simple
: HTTP messages are human readable.
HTTP is extensible
: New HTTP headers can be introduced by a simple agreement between a client and a server.
HTTP is stateless, but not sessionless
: While the core of HTTP itself is stateless, HTTP cookies allow the use of stateful sessions.
HTTP and connections
: Keep-Alive and call a better transport protocol.
If HTTP pipelining is activated, several requests can be sent without waiting for the first response to be fully received. HTTP pipelining has proven difficult to implement in existing networks, where old pieces of software coexist with modern versions. HTTP pipelining has been superseded in HTTP/2 with more robust multiplexing requests within a frame.
The most commonly used API based on top of HTTP is the XMLHttpRequest
API, which can be used to exchange data between a user agent
and a server.
The modern Fetch API
provides the same features with a more powerful and flexible feature set.
Another API, server-sent events
, is a one-way service that allows a server to send events to the client, using HTTP as a transport mechanism.
Using the EventSource
interface, the client opens a connection and establishes event handlers. The client browser automatically converts the messages that arrive on the HTTP stream into appropriate Event
objects, delivering them to the event handlers that have been registered for the events' type
if known, or to the onmessage
event handler if no type-specific event handler was established.
HTTP is an extensible protocol that is easy to use. The client-server structure, combined with the ability to simply add headers, allows HTTP to advance along with the extended capabilities of the Web.
Though HTTP/2 adds some complexity, by embedding HTTP messages in frames to improve performance, the basic structure of messages has stayed the same since HTTP/1.0. Session flow remains simple, allowing it to be investigated, and debugged with a simple HTTP message monitor.
An overview of HTTP - HTTP | MDN
MDN 上的文档还是很棒的。