The client's HTTP message, called the request message
The server-side is called the response message.
The HTTP message itself is a string literal consisting of multirow (with Cr+lf as a newline character) data.
The HTTP message is roughly divided into two parts: header and message body.
Structure of request message and response message
In the process of transmission, the message can also be compressed and encoded. In addition, the packets are chunked and transmitted in small chunks (packets).
Get scope requests for partial content
Previously, users can not use high-speed Internet, download the larger picture is very difficult, if the download process encountered a network interruption, it must start again, in order to solve the above problems, a recoverable mechanism is needed. The so-called recovery refers to the ability to resume downloads from a previous download outage.
Content-range: Can be used to make requests part of the content.
For a range request, the response returns a status code of 206 partial content response message, and if the server is unable to respond to a range request, the status code of OK and full entity content is returned.
Return Status Code
OK all OK
204 No Content request has been successfully processed, but the body part of the entity is not included in the returned response message, and no entity body is allowed to be returned
206 partial content that responds to a partial request
301 Moved Permanently Permanent redirection, status indicates that the requested resource has been assigned a new URI, and later uses the new URI
302 Found Temporary redirection, indicating that the resource for the second request has been assigned a new URI and that the user can use the new URI this time
303 See other root 302 is similar, and requires the user to use the GET method on the next request.
Note: When 301, 302, 303 response status codes are returned, almost all browsers will change the POST to get and delete the subject within the request message, and the request will be sent again automatically.
304 not Modified root above 3XX different, with the redirect does not matter, indicates the request with the condition, if the condition is not satisfied, returns 304
307 temporary Redirect, temporary redirect, same as 302
4XX Client Error
The request message contains a syntax error
401 Unauthorized No permissions, authentication failed
403 Forbidden The requested resource is rejected by the server (the server does not need to provide justification)
404 Not Found, the resource you requested was not seen on the server
5XX Server Error
The server error, Internal, indicates that an error occurred during the request process.
503 Service unavailable, the server is temporarily over-loaded or is undergoing downtime maintenance and is now unable to process requests.
HTTP Message http