Home > other >  10 minutes a status code
10 minutes a status code

Time:09-24

When we were from the client sends a request to the server
The server returned a status code to us
Status code is told us that the server response state
Through it, we can know the current request is successful or what is wrong with
Status code is made up of three Numbers and reason phrase (such as one of the most common: 200 OK)
The first digit said response categories, response category from 1 to 5 is divided into five kinds of
Add: actually I check data found that there is a 6 heading a 600 Unparseable Response Headers
Said the server returns a response in the head, only to return to solid content, also exactly server error status code, but definitely not common

Status code response categories reason phrase 1 xx Informational status code (Informational) Server is processing the request 2 xx successful status code (Success) request has been processed 3 xx normal Redirection status code (Redirection) the need for additional operation to complete the request 4 xx Client Error status code (Client Error) Client causes the Server cannot process the request 5 xx Server Error status code (Server Error) Server causes Error processing request

Status code is must comply with the definition of response categories, the two digits behind the server, there is no problem
your DIYRFC2616 (used to specify the HTTP protocol standard document) has more than 40 types of standard definition, plus extensions can reach 60 kinds of
But only about 14 kinds of common, then I would like to introduce the representative 14 kinds of HTTP status code

2 xx success

200 OK

Said the request by the server to normal processing
The most common is the
As the status code returned by the information related to your request method
A GET request, for example, the request of resources may as a response to return to
And HEAD request, information exists only in response to a message first, because it does not return a message entity, only return a message first



204 No Content

According to the request has been successfully processed, but there is no back content (content should not return status)
Is the response returned no message in the message entity (in fact is not the main body of the message entity)
Received $204 after the browser sends a request to the server, the browser page is not going to happen to update
Commonly used in just the client to the server to send information, what information need not returned to the client and server
the condition of the

206 Partial Content

Said the server has completed the partial GET request requests for the range (the client)
Response message contained in the Content - Range specified Range of entity Content


3 xx redirect

301 version Permanently

Permanent redirect, said the requested resource has permanently moved to another location
Means that resources have been allocated a new URI
New URI should be prompt in response to the Location of the first message field
As long as it's not a HEAD request and response entity should contain new URI hyperlinks and short



302 Found

Temporary redirect, said requested resource temporarily moved to another location
Requested resource temporarily is match to the new URI
And 301 is like, just is a temporary move, resources in the future may also change
Likewise, new temporary URI should prompt in response to the Location of the first message field
As long as it's not a HEAD request and response entity should contain the new URI hyperlinks and short Ming



303 See Other

Says request resources exist another URI, you should use the GET GET request resource oriented
Function of 303 and 302, the difference is only 303 clear client should use the GET access
(a lot of HTTP/1.1 browser doesn't understand before 303, but everybody treat 302 when 303, using the GET request the new UI)



304 Not Modified

Said the request of the client sends conditional (the GET method request message the IF...). When the conditions are not satisfied
Return to 304, does not contain any response body
Although 304 is divided in 3 xx, and redirect a dime didn't



307 Temporary Redirect

Temporary redirect, and 302 have the same meaning
Although 302 standard that POST to GET, but no one is listening to his
And 307 will follow the standard, not from the POST to GET
But process the response behavior, clear for each accumulator may be different



4 xx client error

400 Bad Request

Says the request packet had grammatical mistakes or parameter error, the server doesn't understand
The server should not repeat submitted this request
Need to modify please send again later


401 Unauthorized

Said send request requires HTTP authentication information or authentication failed
Return 401 response must contain a applies to the requested resource WWW - Authenticate first to inquiry user information
The browser first to accept 401, window will pop up certification



403 who

Access control said the request was rejected by the server
The server can explain it, also can not explain
Want to explain words can describe reasons in the main body of the response entity
For instance may not have access to



404 Not Found

Said the server could not find the resource you requested
May also be server is don't want to give you and cheat you can't find (even though? Even though
And most services are so play this status code



5 xx server error

Internal Server Error 500

Said server to perform the requested time wrong
May be a Web application has a bug or temporary failure
More but server source code has a bug...



503 Service Unavailable

Said server overload or downtime, unable to process request
How long does it take to if the server knows it, just write Ret y - After the first field return


Conclusion

Return a status code and status of inconsistent situation is likely to
Internal error such as Web applications, but still return
00 OK

200 OK
Normal request processed 204 No Content
The body of the request is successful, no physical return 206 Partial Content
Scope of the GET request has been successfully processed 301 version Permanently
Permanent redirect resources has permanently assigned new URI302 Found
A redirect resources has been temporary assigned new URI303 See Other
Temporary redirect, expect to use GET directional obtain 304 Not Modified
Send the conditional request did not meet the 307 Temporary Redirect
Temporary redirect, the POST will not be GET400 Bad Request
Request message syntax error or parameter error 401 Unauthorized
Need through HTTP authentication, or authentication failed 403 Forbidden
Request resources be declined to 404 Not Found
Unable to find a request resources (Server has no reason to refuse) 500 Internal Server Error
Failure of the server or Web application Service Unavailable 503
The server load or downtime
  • Related