Home  >  Article  >  What are the http request status codes?

What are the http request status codes?

百草
百草Original
2023-10-12 16:17:061356browse

http request status codes include 100, 101, 200, 201, 204, 301, 302, 304, 400, 401, 403, 404, 500, 502, 503, etc. Detailed introduction: 1. 100 Continue, indicating that the server has received the header of the request, and the client should continue to send the main part of the request; 2. 101 Switching Protocols, indicating that the server has understood and accepted the client's request, and will upgrade through the protocol mode switching and so on.

What are the http request status codes?

The operating system for this tutorial: Windows 10 system, DELL G3 computer.

HTTP request status code refers to the identification of the server's response status to the HTTP request initiated by the client. They are used to represent the processing results of a request so that the client can understand how the server handled the request. HTTP status codes consist of three digits and are divided into five categories, namely 1xx, 2xx, 3xx, 4xx and 5xx. The HTTP request status codes for each category are described in detail below.

1xx category: Informational status code

The status code of the 1xx category indicates that the server has received the request, is processing it, or requires further action. These status codes do not indicate success or failure; they are used to convey information only.

- 100 Continue: Indicates that the server has received the header of the request and the client should continue sending the body of the request.

- 101 Switching Protocols: Indicates that the server has understood and accepted the client's request, and will switch to a new protocol through protocol upgrade.

2xx category: Success status code

2xx category status code indicates that the server has successfully received, understood, and processed the request.

- 200 OK: Indicates that the request was successful and the server has successfully processed the request.

- 201 Created: Indicates that the request was successful and the server has created a new resource.

- 204 No Content: Indicates that the request was successful, but the server did not return any content.

3xx Category: Redirect Status Codes Status codes in the

3xx category indicate that the client needs to take further action to complete the request.

- 301 Moved Permanently: Indicates that the requested resource has been permanently moved to a new URL.

- 302 Found: Indicates that the requested resource has been temporarily moved to a new URL.

- 304 Not Modified: Indicates that the requested resource sent by the client has not been modified on the server, and the locally cached copy can be used directly.

4xx category: Client error status code The status code of the

4xx category indicates that there is an error in the request sent by the client.

- 400 Bad Request: Indicates that the request sent by the client has a syntax error and the server cannot understand it.

- 401 Unauthorized: Indicates that the client needs to authenticate to obtain the requested resource.

- 403 Forbidden: Indicates that the server rejected the client's request.

- 404 Not Found: Indicates that the requested resource does not exist.

5xx Category: Server Error Status Code The status code of the

5xx category indicates that an error occurred while the server was processing the request.

- 500 Internal Server Error: Indicates that an unknown internal error occurred while the server was processing the request.

- 502 Bad Gateway: Indicates that the server, acting as a gateway or proxy, received an invalid response from the upstream server.

- 503 Service Unavailable: Indicates that the server is temporarily unable to process the request, usually due to server overload or maintenance.

Summary:

HTTP request status code is used to indicate the server's processing result of the client's request. Different status codes represent different meanings. The client can determine whether the request is successful based on the status code and take corresponding actions. Knowing and understanding HTTP request status codes is important for developing and debugging web applications.

The above is the detailed content of What are the http request status codes?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn