The HTTP response message format is mainly divided into the following 4 parts:
1, status line
2. Response Head
3, empty line
4. Response body
One, the status line consists of 3 parts, namely: HTTP protocol version, status code, status code description
The status code is 3 digits, starting with 1, 2, 3, 4, and 5, 2 starts with a successful response, 3 starts with a redirect, 4 refers to a client error, and 5 starts with a server error. Detailed status codes are not introduced, here are a few common examples:
200: Successful response
400: Bad request, the user sent an incorrect HTTP request
404: File does not exist, that is, HTTP request URI error
500: Server Internal Error
2, the response header is similar to the request header, and contains a lot of useful information
3, blank line, this line is very important, necessary , indicating that the response to the end of the head, followed by the response body
4, response body, document returned by the server, most common for HTML pages
Response Example:
HTTP message Format