HTTP协议状态码 - Mr.Ding

HTTP协议状态码

天天记事 472 / 2021-12-12 12:47:51

1xx 这些状态代码表示临时的响应。客户端在收到常规响应之前,应准备接收一个或多个1xx响应。


100 - Continue: 初始的请求已经接受,客户应当继续发送请求的其余部分。(HTTP 1.1新)
101 - Switching Protocols: 服务器将遵从客户的请求转换到另外一种协议(HTTP 1.1新)
103 - Checkpoint: 在可恢复请求提案中用于恢复中止的PUT或POST请求

2xx 请求成功,表示成功处理了请求的状态代码。


200 - OK: 成功,服务器已成功处理了请求。 通常,这表示服务器提供了请求的网页。
201 - Created: 已创建,请求成功并且服务器创建了新的资源。
202 - Accepted: 已接受,服务器已接受请求,但尚未处理。
203 - Non-Authoritative Information: 非授权信息,服务器已成功处理了请求,但返回的信息可能来自另一来源。
204 - No Content: 无内容,服务器成功处理了请求,但没有返回任何内容。
205 - Reset Content: 重置内容,服务器成功处理了请求,但没有返回任何内容。
206 - Partial Content: 部分内容,服务器成功处理了部分请求,如GET。

3xx 要完成请求,需要进一步操作,通常,这些状态代码用来重定向。


300 - Multiple Choices: 多种选择,针对请求,服务器可执行多种操作。 服务器可根据请求者 (user agent) 选择一项操作,或提供操作列表供请求者选择。
301 - Moved Permanently: 永久移动,请求的网页已永久移动到新位置。 服务器返回此响应(对 GET 或 HEAD 请求的响应)时,会自动将请求者转到新位置。
302 - Found: 临时移动,服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。
303 - See Other: 查看其他位置,请求者应当对不同的位置使用单独的 GET 请求来检索响应时,服务器返回此代码。
304 - Not Modified: 未修改,自从上次请求后,请求的网页未修改过。 服务器返回此响应时,不会返回网页内容。
305 - Switch Proxy: 使用代理,请求者只能使用代理访问请求的网页。 如果服务器返回此响应,还表示请求者应使用代理。
307 - Temporary Redirect: 临时重定向,服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。
308 - Resume Incomplete: 在可恢复请求提案中用于恢复中止的PUT或POST请求

4xx 请求错误,这些状态代码表示请求可能出错,妨碍了服务器的处理。


400 - Bad Request: 错误请求,服务器不理解请求的语法。
401 - Unauthorized: 未授权,请求要求身份验证。 对于需要登录的网页,服务器可能返回此响应。
402 - Payment Required: 留作将来使用
403 - Forbidden: 禁止,服务器拒绝请求。
404 - Not Found: 未找到,服务器找不到请求的网页。
405 - Method Not Allowed: 方法禁用,禁用请求中指定的方法。
406 - Not Acceptable: 不接受,无法使用请求的内容特性响应请求的网页。
407 - Proxy Authentication Required: 需要代理授权,此状态代码与 401(未授权)类似,但指定请求者应当授权使用代理。
408 - Request Timeout: 请求超时,服务器等候请求时发生超时。
409 - Conflict: 冲突,服务器在完成请求时发生冲突。 服务器必须在响应中包含有关冲突的信息。
410 - Gone: 已删除,如果请求的资源已永久删除,服务器就会返回此响应。
411 - Length Required: 需要有效长度,服务器不接受不含有效内容长度标头字段的请求。
412 - Precondition Failed: 未满足前提条件,服务器未满足请求者在请求中设置的其中一个前提条件。
413 - Request Entity Too Large: 请求实体过大,服务器无法处理请求,因为请求实体过大,超出服务器的处理能力。
414 - Request-URI Too Long: 请求的URI过长,服务器无法处理。
415 - Unsupported Media Type: 不支持的媒体类型,请求的格式不受请求页面的支持。
416 - Requested Range Not Satisfiable: 请求范围不符合要求,如果页面无法提供请求的范围,则服务器会返回此状态代码。
417 - Expectation Failed: 未满足期望值,服务器未满足“期望”请求标头字段的要求。

5xx 服务器错误,这些状态代码表示服务器在尝试处理请求时发生内部错误。 这些错误可能是服务器本身的错误,而不是请求出错。


500 - Internal Server Error: 服务器内部错误,服务器遇到错误,无法完成请求。
501 - Not Implemented: 尚未实施,服务器不具备完成请求的功能。 例如,服务器无法识别请求方法时可能会返回此代码。
502 - Bad Gateway: 错误网关,服务器作为网关或代理,从上游服务器收到无效响应。
503 - Service Unavailable: 服务不可用,服务器目前无法使用(由于超载或停机维护)。 通常,这只是暂时状态。
504 - Gateway Timeout: 网关超时,服务器作为网关或代理,但是没有及时从上游服务器收到请求。
505 - HTTP Version Not Supported: HTTP版本不受支持,服务器不支持请求中所用的HTTP协议版本。
506 - Network Authentication Required: 客户端需要进行身份验证才能访问网络



配个表格

1xx: Information

Message
Description
100 - ContinueThe server has received the request headers, and the client should proceed to send the request body
101 - Switching ProtocolsThe requester has asked the server to switch protocols
103 - CheckpointUsed in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Message
Description
200 - OKThe request is OK (this is the standard response for successful HTTP requests)
201 - CreatedThe request has been fulfilled, and a new resource is created
202 - AcceptedThe request has been accepted for processing, but the processing has not been completed
203 - Non-Authoritative InformationThe request has been successfully processed, but is returning information that may be from another source
204 - No ContentThe request has been successfully processed, but is not returning any content
205 - Reset ContentThe request has been successfully processed, but is not returning any content, and requires that the requester reset the document view
206 - Partial ContentThe server is delivering only part of the resource due to a range header sent by the client

3xx: Redirection

Message
Description
300 - Multiple ChoicesA link list. The user can select a link and go to that location. Maximum five addresses
301 - Moved PermanentlyThe requested page has moved to a new URL
302 - FoundThe requested page has moved temporarily to a new URL
303 - See OtherThe requested page can be found under a different URL
304 - Not ModifiedIndicates the requested page has not been modified since last requested
306 - Switch ProxyNo longer used
307 - Temporary RedirectThe requested page has moved temporarily to a new URL
308 - Resume IncompleteUsed in the resumable requests proposal to resume aborted PUT or POST requests

4xx: Client Error

Message
Description
400 - Bad RequestThe request cannot be fulfilled due to bad syntax
401 - UnauthorizedThe request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided
402 - Payment RequiredReserved for future use
403 - ForbiddenThe request was a legal request, but the server is refusing to respond to it
404 - Not FoundThe requested page could not be found but may be available again in the future
405 - Method Not AllowedA request was made of a page using a request method not supported by that page
406 - Not AcceptableThe server can only generate a response that is not accepted by the client
407 - Proxy Authentication RequiredThe client must first authenticate itself with the proxy
408 - Request TimeoutThe server timed out waiting for the request
409 - ConflictThe request could not be completed because of a conflict in the request
410 - GoneThe requested page is no longer available
411 - Length RequiredThe "Content-Length" is not defined. The server will not accept the request without it
412 - Precondition FailedThe precondition given in the request evaluated to false by the server
413 - Request Entity Too LargeThe server will not accept the request, because the request entity is too large
414 - Request-URI Too LongThe server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information
415 - Unsupported Media TypeThe server will not accept the request, because the media type is not supported
416 - Requested Range Not SatisfiableThe client has asked for a portion of the file, but the server cannot supply that portion
417 - Expectation FailedThe server cannot meet the requirements of the Expect request-header field

5xx: Server Error

Message
Description
500 - Internal Server ErrorA generic error message, given when no more specific message is suitable
501 - Not ImplementedThe server either does not recognize the request method, or it lacks the ability to fulfill the request
502 - Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server
503 - Service UnavailableThe server is currently unavailable (overloaded or down)
504 - Gateway TimeoutThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server
505 - HTTP Version Not SupportedThe server does not support the HTTP protocol version used in the request
511 - Network Authentication RequiredThe client needs to authenticate to gain network access
http