Common HTTP status codes

Here is the list I used in the project had a number of HTTP status codes, of course, in the specific use is not used in the state code as possible, it requires a combination of circumstances to choose their own projects for their own HTTP status code.

 
HTTP status code Meaning Description
200 - OK Request was successful, the request or response header desired data volume will vary with the response returns. This status code appears is a normal state. (Successful, the server has successfully processed the request. Typically, this means that the server provided the requested page)
201 - Created The request has been achieved, but there is a new resource has been established based on the needs and requests, and the URI has returned with Location header information. If the required resources can not be established in a timely manner, it should return '202 Accepted'. (It has been created, the request was successful and the server created a new resource)
202 - Accepted The server has accepted the request, but has not yet processed. As it may be rejected as the final request it may or may not be executed. In the case of asynchronous operation, no more convenient than sending the status code of practice. (It has been accepted, the server has accepted the request, but has not yet processed)
204 - No Content
Server successfully processed the request, but is not required to return any entity content, and want to return updated meta-information. Response may be in the form of the head of the entity, and returns the new or updated metadata information. If the header information exists, it should be aligned with the requested variable.
If the client is a browser, then the user's browser should be retained to send a page of the request, without producing changes in the document view any, even under the meta information, or update a new code should be applied to the user's browser activities view the document.
Since 204 is disabled in response to contain any message body, so it is always the first blank line after the end of the message header. (No content server successfully processed the request, but is not returning any content)
 400 - Bad Request

 1, semantic error, the current request can not be understood by the server. Unless modified, otherwise the client should resubmit the request. 
 2, the request parameter is incorrect. (Bad Request, the server does not understand the syntax of the request)

 401 - Unauthorized  User authentication is required for the current request. The response must include a suitable WWW-Authenticate header of the requested resource to query the user information. The client can request a repeat submission Authorization header contains the appropriate information. If the current request has been included Authorization credentials, then the 401 response indicates that the server has verified that the certificate rejected. If the 401 response contains the same authentication inquiry and before a response, and the browser has been at least try once verified, the browser should display entity information included in the response to the user, because the entity information could include relevant diagnostic information . (Unauthorized request requires authentication for login-protected pages, the server might return this response.)
 403 - Forbidden  Server has understood the request, but refused to implement it. The difference is that with the 401 response, authentication does not provide any help, but this should not be repeated request submitted. If this is not a HEAD request, the server and want to make it clear why the request can not be executed, then they should refuse described in the entity. Of course, the server can also return a 404 response, if it does not want the client to get any information. (Disabled, the server rejects the request)
 404 - Not Found  Request fails, the request would have liked resource is not found on the server. Information can not tell in the end user of this situation is temporary or permanent. If the server knows the case, the status code 410 should be used to inform the old resource allocation mechanism because of some internal problems, it has permanently unavailable, and no addresses can jump. This status code 404 is widely used in the case where the server does not want to reveal why the request was denied in the end or any other suitable response available. This error occurs most likely reason is that the server does not have this page. (Not found, the server can not find the requested page)
 405 - Method Not Allowed  Request method specified in the request line corresponding resources can not be used to request. The response must return an Allow header information list request process is shown for the current resource can accept.
Given PUT, DELETE method resources on the server will be written, and thus most of the web servers do not support or do not allow the above request method in the default configuration for such a request will return a 405 error. (Method disabled, disable the method specified in the request)
 415 - Unsupported Media Type  For the current format of the entity is not a server method request and the requested resources, the request submitted supported, so the request is denied. (Unsupported media type, the request format not request support page)
 500 - Internal Server Error  The server encountered an unexpected condition that causes it could not complete the processing of the request. Generally, this problem will occur when server-side source code errors. (Internal Server Error The server encountered an error and could not complete your request)
 503 - Service Unavailable  Due to a temporary overloading or server maintenance, server is currently unable to handle the request. This situation is temporary, and will be restored at a later time. If the delay time can be expected, the response may comprise a Retry-After header to indicate the delay time. If no Retry-After this information, the client should be handled in a manner that the 500 response.
Note: There is a 503 status code does not imply that a server must use it when overloaded. Some servers just want to deny client connections. (Service unavailable, the server is currently unavailable (because it is overloaded or down for maintenance). Typically, this is a temporary state)
   
 Prefix  General
1xx This type of status codes representative request has been accepted, the need to continue the processing. Such response is a temporary response, comprising only the status line and header information in response to some alternative, and end with a blank line. Since the HTTP / 1.0 protocol does not define any 1xx status codes, so unless under certain test conditions, the server transmits prohibited 1xx response to such client.
2xx This type of status codes representative of the server request has successfully been received, understood and accepted.
3xx
Such status codes on behalf of the client needs to take further action to complete the request. Typically, these status codes for redirection, the subsequent request address (redirection target) Location field specified in this response.
当且仅当后续的请求所使用的方法是 GET 或者 HEAD 时,用户浏览器才可以在没有用户介入的情况下自动提交所需要的后续请求。客户端应当自动监测无限循环重定向(例如:A->A,或者A->B->C->A),因为这会导致服务器和客户端大量不必要的资源消耗。按照 HTTP/1.0 版规范的建议,浏览器不应自动访问超过5次的重定向。
4xx
这类的状态码代表了客户端看起来可能发生了错误,妨碍了服务器的处理。除非响应的是一个 HEAD 请求,否则服务器就应该返回一个解释当前错误状况的实体,以及这是临时的还是永久性的状况。这些状态码适用于任何请求方法。浏览器应当向用户显示任何包含在此类错误响应中的实体内容。
如果错误发生时客户端正在传送数据,那么使用TCP的服务器实现应当仔细确保在关闭客户端与服务器之间的连接之前,客户端已经收到了包含错误信息的数据包。如果客户端在收到错误信息后继续向服务器发送数据,服务器的TCP栈将向客户端发送一个重置数据包,以清除该客户端所有还未识别的输入缓冲,以免这些数据被服务器上的应用程序读取并干扰后者。
5xx、6xx
这类状态码代表了服务器在处理请求的过程中有错误或者异常状态发生,也有可能是服务器意识到以当前的软硬件资源无法完成对请求的处理。除非这是一个HEAD 请求,否则服务器应当包含一个解释当前错误状态以及这个状况是临时的还是永久的解释信息实体。浏览器应当向用户展示任何在当前响应中被包含的实体。
这些状态码适用于任何响应方法。

 

 

更多 HTTP 状态码可参考百度百科: HTTP状态码

大白话:查询网

 

参考链接:https://www.jianshu.com/p/bdea0385a77e

Guess you like

Origin www.cnblogs.com/wwct/p/12329679.html