Duties and responsibilities
The status code was added in http1.0 to describe the return result of the request when the client sends a request to the server. With the help of the status code browser, the server can know whether the request was properly processed or an error occurred.
TODO: method of GETPOST request
composition
It consists of three digits and a reason phrase. Such as 200 OK. The first digit of the number specifies the response category, and the last two digits are unclassified.
The response categories
category |
The reason the phrase |
|
1XX |
Informational status code (Informational) |
Received request |
2XX |
Success status Code (Success) |
The request is successfully processed |
3XX |
Redirection status code |
Additional action is required to complete the request |
4XX |
Client Error status code |
The server cannot process the request |
5XX |
Server Error status code |
The server failed to process the request |
Common HTTP status code
As long as the definition of the status code category is followed, it is no problem to change the status code defined in RFC2626 or create the status code by the server. There are as many as 40 types of status codes recorded in RFC2616 alone, plus webDAV (RFC 2518) and additional HTTP status codes (RFC6585), There are more than 60. Because there are too many, we only select the commonly used status codes for each category for explanation. Please refer to all status codes:
Baike.baidu.com/item/HTTP%E…
RFC is an Internet technical standard document developed by the Internet Engineer Task Force (IETC) and currently supported by ISOC (Internetional) The current RFC documents include communication protocols, Internet specifications, protocols and a series of network basic documents
1XX (Informational status Code)
describe
The delegate request has been accepted and needs to continue processing. This type of response is a temporary response, containing only the status line and some optional response header information, and ending with an empty line. Since no 1XX status code is defined in the HTTP/1.0 protocol, the server forbids sending 1XX responses to such clients except under certain test conditions.
species
There are three, from 100 to 102
- 100 Continue
- 101 Switching Protocols
- 102 Processing
The commonly used
The 1XX status code is not commonly used
2XX (Success status code)
describe
Indicates that the request was successfully received, understood, and accepted by the server.
species
There are eight, ranging from 200 to 207
- 200 OK
- 201 Created
- 202 Accepted
- 203 Non-Authoritative Information
- 204 No Content
- 205 Reset Content
- 206 Partial Content
- 207 Multi-Status
The commonly used
200 OK (request successful)
The request was successful, and the desired response header or data body is returned with this response. The presence of this status code indicates normal status.
204 No Content (No return after request succeeded)
The server successfully processed the request, but does not need to return any physical content and wants to return updated meta-information. The response may return new or updated meta information in the form of entity headers.
206 Partial Content (Scope Request)
Indicates that the client makes a Range request, and the server successfully executes this part of the GET request, and responds to the entity Content of the content-range specified in the packet. HTTP download tools such as FlashGet or Xunlei use this type of response to implement breakpoint continuation or break up a large document into multiple download segments at the same time.
3XX
describe
This type of status code indicates that the client needs to take further action to complete the request. Typically, these status codes are used for redirection, and subsequent request addresses (redirect targets) are specified in the Location field of this response.
species
There are eight of them, from 300 to 307
- 300 Multiple Choices
- 301 Moved Permanently
- 302 Move Temporarily
- 303 See Other
- 304 Not Modified
- 305 Use Proxy
- 306 Switch Proxy
- 307 Temporary Redirect
The commonly used
301 Moved Permanently
Permanent redirect, the requested resource has been permanently moved to the new location, and any future references to this resource should use one of the urIs returned by this response. If possible, clients with link editing capabilities should automatically change the requested address to the one that is returned from the server. Unless otherwise specified, the response is also cacheable.
302 Move Temporarily
Temporary redirects, in which the requested resource temporarily responds to the request from a different URI. Since such redirects are temporary, the client should continue to send future requests to the original address. The response is cacheable only if specified in cache-Control or Expires.
303 See Other
This status code indicates that because another URI exists for the requested resource, the GET method should be used to GET the requested resource. 303 and 302 have the same functionality, except that 303 explicitly states that the client should use the GET method to request
304 Not Modified
A very common status code used to indicate a negotiated cache, note that ⚠️ : 304, although in the 3XX category, has nothing to do with redirection
307 Temporary Redirect
Temporary redirect, the same meaning as 302, except that 307 complies with browser standards and does not change from POST to GET
4XX
describe
Indicates that the client is the cause of the error
species
There are twenty or thirty species
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Request Entity Too Large
- 414 Request-URI Too Long
- 415 Unsupported Media Type
- 416 Requested Range Not Satisfiable
- 417 Expectation Failed
- 418 I’m a teapot
- 419 Authentication Timeout (not in RFC 2616)
- 420 Method Failure
- 421 Misdirected Request
- 422 Unprocessable Entity
- 423 Locked
- 424 Failed Dependency
- 425 Too Early
- 426 Upgrade Required
- 449 Retry With
- 450 Blocked by Windows Parental
- 451 Unavailable For Legal Reasons
- 494 Request Header Too Large (Nginx)
- 495 Cert Error (Nginx)
- 496 No Cert (Nginx)
- 497 HTTP to HTTPS (Nginx)
- 498 Token expired/invalid (Esri)
- 499 Client Closed Request (Nginx)
- 499 Token required (Esri)
The commonly used
400 Bad Request
- The current request cannot be understood by the server. The client should not re-submit this request unless it is modified.
- The request parameters are incorrect.
401 Unauthorized
The status code indicates that the sent request requires HTTP authentication information. If the request has been made once before, the user authentication fails.
403 Forbidden
This status indicates that the access to the requested resource is denied by the server. The server does not provide a detailed reason for the denial. You are not authorized to access the file system or have access permissions problems.
404 NOT Found
The requested resource cannot be found on the server, or it can be used when the server rejects the request without giving a reason
5XX
describe
An error occurred on the server itself
species
More than a dozen
- 500 Internal Server Error
- 501 Not Implemented
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout
- 505 HTTP Version Not Supported
- 506 Variant Also Negotiates
- 507 Insufficient Storage
- 508 Loop Detected
- 509 Bandwidth Limit Exceeded
- 510 Not Extended
- 511 Network Authentication Required
The commonly used
500 Internal Server Error
The server encountered an unexpected condition that prevented it from completing processing the request. Typically, this problem occurs when the source code on the server side is faulty.
502 Bad Gateway
An invalid response was received from the upstream server when a server working as a gateway or proxy tried to execute the request.
503 Service Unavailable
The server is currently unable to process requests due to temporary server maintenance or overload. The situation is temporary and will recover over time
504 Gateway Timeout
When a server working as a gateway or proxy tries to execute a request, it fails to receive a response from an upstream server (a server identified by a URI, such as HTTP, FTP, or LDAP) or a secondary server (such as DNS) in a timely manner.
Note ⚠️ : Some proxy servers may return 400 or 500 errors when DNS queries time out
6XX
600 Unparseable Response Headers
The source site does not return the response header, only the physical content
reference
Baike.baidu.com/item/HTTP%E…
The illustration of HTTP