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

How to parse the status code of HTTP server

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to parse the HTTP server status code. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

When doing interface testing and performance testing, there will be more HTTP errors to view the errors, such as timeout, unable to link to the picture, unable to connect to the server, and so on. So let's sum up this piece of knowledge.

HTTP server status code definition (Status Code Definitions)

1.1 message 1xx (Informational 1xx)

This type of status code is used to represent an ad hoc response. The temporary response consists of a status line (Status-Line) and an optional header, terminated by a blank line. There are no status codes for any 1xx defined in HTTP/1.0, so they are not legitimate responses to HTTP/1.0 requests. In fact, they are mainly used for experimental purposes, which is beyond the scope of this document.

1.2 successful 2xx (Successful 2xx)

Indicates that the client request is successfully received, understood, and accepted.

200 OK

The request was successful. The information for the response depends on the method used in the request, as follows:

The resource to be requested by GET is already in the responding entity.

HEAD has no entity body, and only the title information is included in the response.

POST entity (describes or contains the results of an operation).

201 Created

The request is completed, and as a result, a new resource is created. The URI of the newly created resource is available in the responding entity. The original server should create the resource before issuing the status code. If the operation cannot be completed immediately, the server must give a prompt in the response subject when the resource is available, otherwise the server side should respond 202 (acceptable).

In the methods defined in this article, only POST can create resources.

202 Accepted

The request was accepted, but the processing has not been completed. The request may not be completed eventually, and the processing may be interrupted at any time, in which case there is no way to resend the status code in an asynchronous operation.

202 there is no obligation to respond, and the purpose of this is to allow the server to respond to requests from other processes (such as batch-based processes that run once a day) without waiting for the end of the connection between the user agent and the server.

The entities returned in some responses include the status indication of the current request, the status monitor pointer, or the user's assessment of whether the request can be implemented.

204 No Content

The server side has implemented the request, but no new information has been returned. If the customer is a user agent, you do not need to update your own document view for this. The main purpose of this response is to input script statements and other operations without affecting the user agent's activation of the document view. The response may also include new meta-information in the form of entity headers, which can be used by documents in the current user agent active view.

1.3Redirect (Redirection 3xx)

This type of status code indicates that the user agent needs to issue further actions in order to complete the request. These operations can be implemented by the user agent without interaction with the user only if the following request is GET or HEAD. The user agent should never redirect the request more than five times, which may lead to a * loop.

300 Multiple Choices

This status code is not directly used by HTTP/1.0 applications, but is used as the default interpretation of the 3xx type response. There are multiple requested resources available.

Unless it is a HEAD request, the responding entity must include a list of characters and location information for these resources, and it is up to the user or user agent to decide which is the most appropriate.

If the server has * *, it should store the corresponding URL information in the location domain (Location field), and the user agent will automatically redirect according to the value of this domain.

301 Moved Permanently

All requested resources are assigned a * * URL so that the resource can be accessed through that URL in the future. Clients with the ability to edit links will update the request URI automatically according to the new links returned by the server as much as possible. The new URL must be specified by the location field in the response. Unless it is a HEAD request, the entity body (Entity-Body) that responds must include a brief description of the new URL hyperlink.

If a request is made using the POST method and a 301 response status code is received. In this case, unless confirmed by the user, the user agent does not have to automatically redirect the request, as this will result in a change in the environment in which the request has been made.

Note: when the POST request is automatically redirected after receiving the 301 status code, some existing user agents mistakenly change it to the GET request.

302 Moved Temporarily

The requested resource is temporarily stored in a different URL. Because redirection can sometimes be changed, the client should continue to use the request URI to make future requests. The new URL must be specified by the location field in the response. Unless it is a HEAD request, the entity body (Entity-Body) that responds must include a brief description of the new URL hyperlink.

If a request is made using the POST method and a 302 response status code is received. In this case, unless confirmed by the user, the user agent does not have to automatically redirect the request, as this will result in a change in the environment in which the request has been made.

Note: when a POST request is automatically redirected after receiving a 302 status code, some existing user agents mistakenly change it to an GET request.

304 Not Modified

If the client successfully executes the conditional GET request and the corresponding file has not been updated since the date specified by the If-Modified-Since domain, the server should respond to this status code instead of sending the entity principal to the client. Only relevant information should be included in the response title field, such as cache managers and changes that are not related to the date of the entity's last update (entity's Last-Modified). Examples of related title fields are: date, server, expiration time. Whenever the domain value given in the 304 response changes, the cache should update the cached entity.

1.4 client error (Client Error) 4xx

The status code of the 4xx class indicates that an error occurred on the client. If the client has not completed the request when it receives the 4xx code, it should immediately stop sending data to the server. In addition to responding to HEAD requests, the server must include an explanation of the error status in the responding entity, regardless of whether the error is temporary or *. These status codes apply to any request method.

Note: if the client is sending data, the server-side TCP implementation should be careful to ensure that the client receives a response packet before closing the input connection. If the client still sends data to the server after shutting down, the server will send a reset packet to the client to clear the input buffer that has not been processed by the client to terminate the reading and interpretation activities of the HTTP application.

400illegal request (Bad Request)

If the syntax of the request is incorrect, the server will not understand. The client should not repeat the request to the server before making changes to the request.

401 unauthorized (Unauthorized)

The request requires user authorization. The WWW-Authenticate header field in the response (Section 10.16) should prompt the user to request resources in an authorized manner. The client should repeat the request with the appropriate authorization title domain (Section 10.2). If authorization trust information is already included in the request, the 401 of the response indicates that the authorization has been denied. If the user agent returns the 401 status code after many attempts, the user should take a look at the entity of the response, because some relevant dynamic information is included in the entity. HTTP access authorization is explained in section 11.

Forbidden (Forbidden)

The server understands the request but refuses to implement it. Authorization does not help, and the client should stop sending this request repeatedly. If the HEAD request method is not used, and the server is willing to disclose the reason why the request was not implemented, the server will write the rejection reason in the response entity. This status code is generally used when the server does not want to publish the details of the request being rejected or there is no other response available.

404 not found (Not Found)

The server did not find a resource that matches the request URI. The 404 status code does not indicate whether the situation is temporary or sexual. If the server does not want to provide this information to the client, it also responds to the 403 (forbidden) status code.

1.5 Server error (Server Error) 5xx

The response code with a status code starting with'5' indicates that the server has found an error and cannot proceed with the request. If the client receives the 5xx status code and the request has not been completed, it should immediately stop sending data to the server. In addition to responding to HEAD requests, the server should include an explanation of the error condition in its response entity and indicate that it is temporary or sexual.

This kind of response code has no title field and can be applied to any request method.

500 server internal error (Internal Server Error)

The server encountered an unexpected condition that prevented it from responding to requests.

501Unimplemented (Not Implemented)

The server cannot provide support for the functionality requested in the request. If the server does not recognize the request method, it responds to this status code, which means that it cannot respond to any resources requested by the request.

502 illegal Gateway (Bad Gateway)

The server acting as a gateway or proxy receives an illegal response from the upstream (upstream) server to send the request.

503 Service unavailable (Service Unavailable)

The server is currently unable to process the request. This is generally caused by temporary overloading or maintenance of the server. The status code implies that the situation is temporary and will cause some delay.

Note: the 503 status code does not imply that the server must return this status code if it is overloaded. Some servers may want to simply disconnect when they are overloaded.

Large summary of IIS error codes

400 cannot resolve this request. 401.1 unauthorized: access denied due to invalid credentials.

401.2 unauthorized: access is denied because the server configuration tends to use alternative authentication methods.

401.3 unauthorized: access is denied due to ACL's settings for the requested resource.

401.4 unauthorized: the filter installed on the Web server failed to authorize.

401.5 unauthorized: ISAPI/CGI application authorization failed.

401.7 unauthorized: access denied due to URL authorization policy on the Web server.

403 access prohibited: access denied.

403.1 access prohibited: executive access denied.

403.2 No access: read access denied.

403.3 No access: write access denied.

403.4 No access: you need to use SSL to view this resource.

403.5 No access: you need to use SSL 128to view this resource.

403.6 No access: the IP address of the client is denied.

403.7 No access: SSL client certificate is required.

403.8 No access: the DNS name of the client is denied.

403.9 No access: too many clients are trying to connect to the Web server.

403.10 No access: the Web server is configured to deny access.

403.11 No access: password has been changed.

403.12 No access: the server certificate mapper denied client certificate access.

403.13 No access: the client certificate has been revoked on the Web server.

403.14 No access: directory list denied on the Web server.

403.15 No access: the Web server has exceeded the client access license limit.

403.16 No access: the client certificate is malformed or is not trusted by the Web server.

403.17 No access: the client certificate has expired or is not yet valid.

403.18 No access: the requested URL cannot be executed in the current application pool.

403.19 No access: CGI cannot be executed for the client in this application pool.

403.20 No access: Passport login failed.

404 No files or directories were found.

404.1 File or directory not found: the website cannot be accessed on the requested port.

Note that the 404.1 error only occurs on computers with multiple IP addresses. If a client request is received on a specific IP address / port combination and the IP address is not configured to listen on that particular port, IIS returns a 404.1 HTTP error. For example, if a computer has two IP addresses and only one IP address is configured to listen on port 80, any request received by the other IP address from port 80 will cause the IIS to return a 404.1 error. This error should only be set at this service level, because it is returned to the client only if more than one IP address is used on the server.

404.2 File or directory cannot be found: locking policy prohibits the request.

404.3 File or directory cannot be found: the request is prohibited by the MIME mapping policy.

The HTTP action used to access the page is not permitted.

The client browser does not accept the MIME type of the requested page.

The 407 Web server requires initial proxy authentication.

The 410 file has been deleted.

412 the prerequisites set by the client failed when evaluated on the Web server.

The request URL is too large, so the URL is not accepted on the Web server.

500 server internal error.

500.11 Server error: the application on the Web server is closing.

500.12 Server error: the application on the Web server is restarting.

500.13 Server error: the Web server is too busy.

500.14 Server error: invalid application configuration on the server.

500.15 Server error: direct request for GLOBAL.ASA is not allowed.

500.16 Server error: UNC authorization credentials are incorrect.

500.17 Server error: the URL authorization store could not be found.

500.18 Server error: the URL authorization store could not be opened.

500.19 Server error: the data of this file is not configured correctly in the configuration database.

500.20 Server error: the URL authorized domain could not be found.

500 100 Internal Server error: ASP error.

The configuration specified by the 501 header value was not executed.

The 502 Web server received an invalid response when acting as a gateway or proxy server.

The above is the editor for you to share how to parse the HTTP server status code, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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

Servers

Wechat

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

12
Report