Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Common HTTP status codes in Server return

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail the example analysis of common HTTP status codes in server returns. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

HTTP status code

The status code is made up of three digits and a reason phrase (such as the most common: 200OK), where the first digit represents the response category, which is divided into five categories from 1 to 5

Add: actually, I looked up the data and found that there was also a 600 Unparseable Response Headers with a head of six.

Indicates that the server does not return a response header, but only returns physical content, which can be counted as a server error status code, but it is definitely not common.

Status code response category reason phrase 1XX informational status code (Informational) server is processing request 2XX success status code (Success) request has been processed normally 3XX redirect status code (Redirection) additional operation is required to complete the request 4XX client error status code (Client Error) client cause the server cannot process the request 5XX server error status code (Server Error) server error processing request

The definition of the status code response category must be followed, and the next two digital servers have no problem with their own DIY.

There are more than 40 definitions of RFC2616 (documents used to specify HTTP protocol standards), and the number of extensions can reach 60.

However, there are only about 14 common ones. Let me talk about these 14 representative HTTP status codes.

2XX succeeded

200 OK

Indicates that the request is processed normally by the server

This is the most common. As the information returned by this status code is related to your request method, such as a GET request, the requested resource will be returned as the response entity, while the HEAD request, the information will only exist in the header of the response message, because it will not return the message entity, but only the header of the message.

204 No Content

Indicates that the request has been processed successfully, but no content is returned (there should be no content return), that is, there is no message entity in the returned response message (in fact, there is no message entity). If the browser receives 204 after sending the request to the server, then the browser page will not be updated, which is generally used only for the client to send information to the server. When the server does not have to return any information to the client

206 Partial Content

Indicates that the server has completed part of the GET request (the client has made a range request), and the response message contains the entity content of the specified range of Content-Range.

3XX redirection

301 Moved Permanently

Permanent redirection, indicating that the requested resource has been permanently moved to another location, that is, the resource has been assigned a new URI, and the new URI should prompt in the Location header field of the response message. As long as it is not a HEAD request, the response entity should contain a hyperlink and a short description of the new URI.

302 Found

Temporary redirection, indicating that the requested resource is temporarily moved to another location, and the requested resource is temporarily assigned to a new URI, much like 301, except that the resource is temporarily moved and may change in the future. Similarly, the new temporary URI should prompt in the Location header field of the response message, as long as it is not a HEAD request, the response entity should contain a hyperlink and a short description of the new URI.

303 See Other

Indicates that there is another URI for the requested resource, and you should use GET to obtain the requested resource. The function of 303 is the same as that of 302, except that it is clear that the client should be accessed using GET. (many browsers before HTTP/1.1 do not understand 303, but everyone treats 303 as 303 and uses GET to request a new URI)

304 Not Modified

Indicates that the client sends a conditional request (IF in the GET method request message). ), the condition is not satisfied, and when 304 is returned, it does not contain any response subject. Although 304 is divided into 3XX, it has nothing to do with redirection.

307 Temporary Redirect

Temporary redirection, which has the same meaning as 302, although 302 forbids POST to become GET, but no one listens to him, and 307 will follow the standard, will not change from POST to GET, but handle response behavior, different browsers may be different.

4XX client error

400 Bad Request

Indicates that there is a syntax error or parameter error in the request message, and the server does not understand. The server should not submit the request repeatedly. It needs to modify the content of the request and send it again.

401 Unauthorized

Indicates that the request sent requires HTTP authentication information or the authentication failed. The response returned to 401 must contain a WWW-Authenticate header suitable for the requested resource to challenge the user information. When the browser accepts 401 for the first time, the authentication window will pop up.

403 Forbidden

Indicates that access to the requested resource has been denied by the server, which can or may not be explained. If you want to explain, you can describe the reason in the main body of the response entity. For example, you may not have access rights.

404 Not Found

It means that the server cannot find the resource you requested, or it is possible that the server just doesn't want to give it to you and then deceives you into not finding it (⊙ cannot ⊙), and most servers play this status code like this.

5XX server error

500 Internal Server Error

Indicates that the server made a mistake when executing the request. It is possible that the Web application has bug or temporary failure, or more likely that the server source code has bug.

503 Service Unavailable

Indicates that the server is overloaded or is down for maintenance and cannot process the request. If the server knows how long it will take, it will write the Retry-After header field to return.

Summary

It is possible that the returned status code is inconsistent with the status, such as an internal error in the Web application, but still returns 200 OK

200 OK

Normal processing of request completed

204 No Content

The request was processed successfully and no entity principal returned

206 Partial Content

GET scope request processed successfully

301 Moved Permanently

Permanent redirection, the resource has been permanently allocated a new URI

302 Found

Temporary redirection, the resource has been temporarily allocated a new URI

303 See Other

Temporary redirection, expected to be obtained using GET direction

304 Not Modified

The conditional request sent was not met

307 Temporary Redirect

Temporary redirect, POST will not become GET

400 Bad Request

Request message syntax error or parameter error

401 Unauthorized

Need to pass HTTP authentication, or authentication failed

403 Forbidden

The requested resource was rejected

404 Not Found

The requested resource could not be found (the server has no reason to refuse)

500 Internal Server Error

Server failure or Web application failure

503 Service Unavailable

Server overload or downtime maintenance

The above is the whole content of this article, I hope that the content of this article can bring some help to your study or work, if you have any questions, you can leave a message and exchange.

This is the end of the example analysis of the common HTTP status codes returned by the server. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report