First, the characteristics of the HTTP protocol:
- Simple and fast: each resource is a fixed URI
- Flexible: The transfer of different data types can be done via an HTTP protocol
- No connection: The connection is disconnected once and will not remain connected
- Stateless: Customer service and server are two identities, one connection after the disconnection, the next time the connection, the server can not distinguish two times whether the same client-initiated request
Second, the HTTP method:
Get: Get Resources
Post: Transferring resources
Put: Updating resources
Delete: Deleting a resource
Head: Get message header
Three, the difference between get and post
IV. HTTP Message Format
Request message: Request line-Request method, HTTP version, URL address, request header-Some Key-value value, blank line-used to separate the request header and the request body;
Response message: Response Line--http Protocol version number, response return status code, response description, response header, response body
Five, HTTP status code
1XX: Indication information--Indicates that the request has been received and continues processing
2XX: Success-Indicates that the request was successfully received
3XX: Redirect--further action is required to complete the request
4XX: Client Error--Request syntax error or not implemented
5XX: Service-side error-Server failed to implement legitimate request
206: Common when video files are too large, only return part
V. Persistence and pipeline
In normal mode, each HTTP request is sent, and a connection is made and disconnected after completion
Persistent connection (HTTP1.1 version support): When a keep-alive (persistent connection) is used, the keep-alive feature avoids establishing or re-establishing a connection when a subsequent request to the server is present.
Pipelining: In the case of persistent connections, all requests are packaged at once, and all responses are packaged back at once.
HTTP protocol Summary