This is a list of Hypertext Transfer Protocol (HTTP) response status codes. Status codes are issued by a server in response to a client’s request made to the server. It includes codes from IETF Request for Comments (RFCs), other specifications, and some additional codes used in some common applications of the HTTP. The first digit of the status code specifies one of five standard classes of responses. The message phrases shown are typical, but any human-readable alternative may be provided. Unless otherwise stated, the status code is part of the HTTP/1.1 standard (RFC 7231)。
这是超文本传输协议(HTTP)响应状态码的列表。状态码由服务器发出,以响应客户机向服务器发出的请求。它包括来自IETF请求评论(RFCs)的代码、其他规范和一些常见HTTP应用程序中使用的附加代码。状态码的第一个数字指定五个标准响应类别中的一个。所示的消息短语是典型的,但是可以提供任何人类可读的替代方法。除非另有说明,状态码是HTTP/1.1标准的一部分(RFC 7231)。
The Internet Assigned Numbers Authority (IANA) maintains the official registry of HTTP status codes.[2]
(IANA)维护官方注册的HTTP状态码
All HTTP response status codes are separated into five classes or categories. The first digit of the status code defines the class of response, while the last two digits do not have any classifying or categorization role. There are five classes defined by the standard:
所有HTTP响应状态码被分成五个类或类别。状态码的第一个数字定义响应的类,而最后两个数字不具有任何分类或分类作用。该标准定义了五个类:
1xx informational response – the request was received, continuing process
2xx successful – the request was successfully received, understood, and accepted
3xx redirection – further action needs to be taken in order to complete the request
4xx client error – the request contains bad syntax or cannot be fulfilled
5xx server error – the server failed to fulfil an apparently valid request
Contents
1 1xx informational response
2 2xx success
3 3xx redirection
4 4xx client errors
5 5xx server errors
1xx informational response
An informational response indicates that the request was received and understood. It is issued on a provisional basis while request processing continues. It alerts the client to wait for a final response. The message consists only of the status line and optional header fields, and is terminated by an empty line. As the HTTP/1.0 standard did not define any 1xx status codes, servers must not[note 1] send a 1xx response to an HTTP/1.0 compliant client except under experimental conditions.[3]
100 Continue
The server has received the request headers and the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient. To have a server check the request’s headers, a client must send Expect: 100-continue as a header in its initial request and receive a 100 Continue status code in response before sending the body. If the client receives an error code such as 403 (Forbidden) or 405 (Method Not Allowed) then it shouldn’t send the request’s body. The response 417 Expectation Failed indicates that the request should be repeated without the Expect header as it indicates that the server doesn’t support expectations (this is the case, for example, of HTTP/1.0 servers).[4]
101 Switching Protocols
The requester has asked the server to switch protocols and the server has agreed to do so.[5]
102 Processing (WebDAV; RFC 2518)
A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request. This code indicates that the server has received and is processing the request, but no response is available yet.[6] This prevents the client from timing out and assuming the request was lost.
103 Early Hints (RFC 8297)
Used to return some response headers before final HTTP message.[7]
2xx success
This class of status codes indicates the action requested by the client was received, understood, and accepted.[2]
200 OK
Standard response for successful HTTP requests.