Http protocol status code summary

 

 

1. http method

method name illustrate
get Send a get request, the server's response will contain the head and body parts
post Send a request for input data, the server's response will contain the head and body parts
head Only the header part of the server response
put Send a file (resource) to the server
trace When the destination server responds to the request, it will bring the original request message in the main body, which is used by the client to compare the changes made to the data by the firewall, proxy, gateway, etc.
options The request server tells the web server what features it supports
delete Request the server to delete the resource specified by the url

Two, http common status codes

1. 100~199 information status code

status code illustrate
101 switching protocols Protocol switching is implemented through the upgrade response header. The server will switch to the specified protocol after sending the upgrade response. Such as: http1.0 upgrade to http1.1 and so on.

2. 200~299 success status code

status code illustrate
200 ok The request has been successful, and the response headers and data bodies expected by the request are returned with this response
201 created The request has been accepted and a new resource has been created (arrived at the handler) according to the request's needs.
202 Accepted The request has been accepted by the server, but has not yet been processed, the response 202 status code is coming so that the client can also send another request.
203 non-authoritative information The server successfully processed the request, but the entity header meta-information returned was not from a valid deterministic set on the original server, but from a local or third-party copy. The current information may be a subset or superset of the original version
204 no content The request processing is completed, the response has only the entity header and no entity content, and the client does not need to reset the view
205 reset content Consistent with a 204 response, but requires the client to reset the response view
206 partial content Partial response, resumable upload or chunked transfer of large files is this response header

3. 300 ~ 399 redirect status code

status code illustrate
300 Multiple Choices The requested resource has a series of optional feedback information, redirected according to the header meta information
301 Moved Permanently Permanent redirection, the redirection URL should be in the location of the response head, if there is no redirection URL, it should also be included in the response body; if it is not a get or head request, the browser will prohibit redirection unless the user confirms; http /1.0 sends a post request, the response is 301, and the next redirection will also become a get request
302 Move temporarily Temporary redirect, otherwise same as 301. but cache-control or expires headers can be cached
303 see other The current request is on another url, and the client should use get, 303 cannot be cached, but the second request can; http/1.1 handles 303 and 302 the same (most browsers)
304 not modified The client sends a conditional get request and returns 304 indicating cache
305 use proxy The specified resource is on the specified proxy, and the location contains the url where the proxy is located.
307 temporary redirect Consistent with 302

4. 400~499 error status code

status code illustrate
400 bad requrest The client sent a bad request
401 unauthorized Before requiring clients to access this resource, they need to authenticate themselves
403 forbidden Indicates that the request was rejected by the server, and the server is generally unwilling to explain the reason.
404 not found resource not found
405 method not allowed The method returned by the sent request is not supported by the server resource, and the response should contain the allow header
406 not acceptable The client can specify what kind of resources it is willing to accept, if the server cannot provide this status code

5. 500~599 status code

status code illustrate
500 internal server error Internal server error
501 not implemented The client request is beyond the capabilities of the server (eg: the server cannot support the method requested by the client)
502 bad gateway The server used as a proxy gateway received a spurious response from the next link in the request response (eg: it could not connect to the parent its gateway)
503 service unavailable The server cannot currently complete the processing of the request, but will be able to
505 http version not supported 服务器不支持此协议版本

一、http方法

方法名 说明
get 发送一个获取请求,服务器的响应会包含head与body部分
post 发送一个输入数据的请求,服务器的响应会包含head与body部分
head 服务器响应的只有head部分
put 向服务器发送一个文件(资源)
trace 目的服务器在响应请求的时候,会在主体中带上原始的请求报文,用于客户端对比防火墙、代理、网关等对数据做的改变
options 请求服务器告知web服务器支持的功能
delete 请求服务器删除url指定的资源

二、http常用状态码

1. 100~199信息状态码

状态码 说明
101 switching protocols 进行协议切换,通过upgrade响应头实现,服务器在以送完还upgrade响应后就会切换为指定的协议。如:http1.0升级为http1.1等。

2. 200~299成功状态码

状态码 说明
200 ok 请求已成功,请求所希望的响应头和数据体都随此响应返回
201 created 请求已被接受,新资源已依据请求的需求要而建立(到达处理程序)。
202 Accepted 请求已被服务器接受,但尚未处理,响应202状态码是来了让客户端也可以发送另外的请求。
203 non-authoritative information 服务器成功处理请求,但返回的实体头部元信息不是来自原始服务器上有效的确定集合,而是来自本地或第三方的拷贝。当前信息可能是原始版本的子集或超集
204 no content 请求处理完成,响应只有实体头,没有实体内容,客户端可以不重置视图
205 reset content 与204的响应一致,但要求客户端重置响应视图
206 partial content 部分响应,断点续传 或 大文件分块传递就是这个响应头

3. 300 ~ 399重定向状态码

状态码 说明
300 Multiple Choices 被请求的资源有一系列可供选择的回馈信息,根据头元信息重定向
301 Moved Permanently 永久重定向,重定向URL在应该在响应的head中的location上,如果没有重定向URL应该也包含在响应体中;如果不是get和head请求,浏览器会禁止重定向,除非用户确认;http/1.0发送post请求,响应的是301,接下来重定向的也会变成get请求
302 Move temporarily 临时重定向,其他与301一样。但cache-control或expires头可以缓存
303 see other 当前请求在另一个url上,而客户端应该采用get,303不能缓存,第二个请求可以;http/1.1处理303与302是一致的(大部分浏览器)
304 not modified 客户端发送一个带条件get请求,返回304表示缓存
305 use proxy 指定的资源在指定的代理上,location上包含代理所在的url上
307 temporary redirect 与302一致

4. 400~499错误状态码

状态码 说明
400 bad requrest 客户端发送了一个错误的请求
401 unauthorized 要求客户端访问此资源前,需要对自己进行认证
403 forbidden 说明请求被服务器拒绝,此类一般情况下服务器不愿意说明原因
404 not found 找不到资源
405 method not allowed 发送的请求所还的方法服务端资源不支持,响应中应该包含allow头部
406 not acceptable 客户端可以指定自己愿意接受什么样的资源,如果服务端不能提供返回此状态码

5. 500~599状态码

状态码 说明
500 internal server error 服务器内部错误
501 not implemented 客户端请求超出服务器的能力范围(如:服务器不能支持客户端请求的方法)
502 bad gateway 作用代理网关使用的服务器从请求响应的下一条链路上收到了一条伪响应(如:它无法连接到父其网关)
503 service unavailable 服务器现不能完成请求的处理,但将来可以
505 http version not supported 服务器不支持此协议版本

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324790033&siteId=291194637