📅  最后修改于: 2021-01-03 03:13:26             🧑  作者: Mango
服务器响应客户端对服务器的请求而发出HTTP状态代码。状态码是3位整数。状态码的第一位用于指定五个标准响应类别之一。状态码的最后两位数字没有任何分类作用。
状态代码分为5部分,如下所示:
S.N. | Code and Description |
---|---|
1 | 1xx: Informational Response It is used to show that the request was received, and the process is continuing. |
2 | 2xx: Successful It is used to show that the request was successfully received, understood, and accepted. |
3 | 3xx: Redirection It is used to show that further action needs to be taken to complete the request. |
4 | 4xx: Client Error It is used to show that the request contains bad syntax or cannot be fulfilled. |
5 | 5xx: Server Error It is used to show that the server is failed to fulfill an apparently valid request. |
HTTP状态代码是可扩展的。不需要HTTP的应用程序o了解所有已注册状态代码的含义。下面列出了所有状态代码:
Message | Description |
---|---|
100 Continue | It is used to show that the client should continue with its request. The interim response informs the client that the request?s initial part has been received. |
101 Switching Protocols | It is used to switches the server. |
102 Processing | This code is used to show that the server has received and is processing the request. It indicates that no response is available yet. |
103 Early Hints | This code is used to return the headers of some responses before the final HTTP message. |
Message | Description |
---|---|
200 OK | This code is used to show that the request is OK. |
201 Created | This code shows that the request has been fulfilled, which results in the creation of a new resource. |
202 Accepted | This code shows that the request is accepted for processing, but not yet processed completely. |
203 Non-authoritative Information | In the entity-header, the information is from a local third party copy. It is not from the original copy. |
204 No Content | This code is used to show that the request is processed successfully by the server and not returning any content. |
205 Reset Content | This code is used to tell the user agent to reset the document which sent this request. |
Message | Description |
---|---|
300 Multiple Choices | This code is used to indicate that the multiple options for the resource from which the client may choose. |
301 Moved Permanently | This code shows that the URL of the requested resource has been changed permanently. In response, the new URL gives. |
302 Found | This code is used to show that the requested page has moved temporarily to a new URL. |
303 See Other | This code is used to show that the requested page can be found under another URL using the GET method. |
304 No Modified | This code is used for caching purposes. It shows the client that the response has not been modified, so the client can continue to use the same response?s cached version. |
305 Use Proxy | This code is used to show that using the proxy; the requested URL must be accessed, which is mentioned in the Location header. |
306 Unused | In the previous version, this code is used. This response code is no longer used, and it is just reserved. |
307 Temporary Redirect | This code is used to show that the requested page has moved temporarily to a new URL. |
Message | Description |
---|---|
400 Bad Request | This code is used to indicate that the server did not understand the request due to invalid syntax. |
401 Unauthorized | In this code, the requested page needs a username and password. |
402 Payment Required | This code reserved for future use. |
403 Forbidden | This code is used to show that the access is forbidden to the requested page. |
404 No Found | This code is used to show that the server cannot find the requested page. |
405 Method Not Allowed | It shows that the request method is not supported for the requested resource. |
406 Not Acceptable | It is used to show that the server can only generate a resource that the client does not accept. |
407 Proxy Authentication Required | It is used to show that the client must first authenticate itself with the proxy. |
408 Request Timeout | This code is used to show that the request took longer than the server was prepared to wait. |
Message | Description |
---|---|
500 Internal Server Error | This code is used to show that the server has encountered a situation, and it does not know how to handle it. |
501 Not Implemented | This code shows that the request was not completed, and the server did not support the functionally required. |
502 Bad Gateway | This code shows that the request was not completed, and the server received an invalid response from the upstream server. |
503 Service Unavailable | This code shows that the request was not completed, and the server is temporarily overloading or down. |
504 Gateway Timeout | It shows that the gateway has timed out. |
505 HTTP Version Not Supported | This code is used to show that the server does not support the “http protocol” version. |