Home > Operation and Maintenance > Safety > What are the HTTP response status codes?

What are the HTTP response status codes?

WBOY
Release: 2023-05-16 08:37:05
forward
2886 people have browsed it

HTTP is an application layer protocol, although the HTTP/2 version has been launched in 2015 and is supported by major web browsers and web servers.

Its main features can be summarized as follows:

Supports client/server mode.

Simple and fast: When a client requests a service from the server, it only needs to transmit the request method and path. Due to the simplicity of the HTTP protocol, the program size of the HTTP server is small and the communication speed is very fast.

Flexible: HTTP allows the transmission of any type of data object. The type being transferred is marked by Content-Type.

No connection: The meaning of no connection is to limit each connection to only process one request. After the server processes the client's request and receives the client's response, it disconnects. This method saves transmission time.

Stateless: The HTTP protocol is a stateless protocol. Stateless means that the protocol has no memory ability for transaction processing. The lack of status means that if subsequent processing requires the previous information, it must be retransmitted, which may result in an increase in the amount of data transferred per connection. On the other hand, the server responds faster when it does not need previous information. In order to solve this problem, Web programs introduce a Cookie mechanism to maintain state.

In addition, HTTP request messages and response messages are composed of a start line (for a request message, the start line is the request line, for a response message, the start line is the status line), message header (optional), It consists of a blank line (a line with only CRLF) and the message body (optional).

As a software tester, it is essential to understand the meaning of the HTTP status returned by some servers. Only by understanding these status codes can you be handy at work. Let's take a comprehensive look at the HTTP status. Code:

Response status code

The status code consists of three digits. The first digit defines the response category and has five possible values.

1xx: Indication information-indicates that the request has been received and processing continues.

2xx: Success--Indicates that the request has been successfully received, understood, and accepted.

3xx: Redirect--Further operations must be performed to complete the request.

4xx: Client error--The request has a syntax error or the request cannot be fulfilled.

5xx: Server-side error -- The server failed to fulfill a legitimate request.

Common status codes:

1xx - Information prompt

These status codes indicate temporary responses. The client should be prepared to receive one or more 1xx responses before receiving a regular response.

· 100 - Continue The initial request has been accepted and the client should continue sending the remainder of the request.

· 101 - Switching Protocols The server will comply with the client's request and convert to another protocol.

2xx - Success

This type of status code indicates that the server successfully accepted the client request.

· 200 - OK Everything is fine, the response documents for GET and POST requests follow.

· 201 - Created The server has created the document, and the Location header gives its URL.

· 202 - Accepted The request has been accepted, but the processing has not yet been completed.

· 203 - Non-Authoritative Information The document has been returned normally, but some response headers may be incorrect because a copy of the document, non-authoritative information, is used.

· 204 - No Content There is no new document, the browser should continue to display the original document. This status code is useful if the user refreshes the page regularly and the servlet can determine that the user's document is current enough.

· 205 - Reset Content There is no new content, but the browser should reset the content it displays. Used to force the browser to clear form input content.

· 206 - Partial Content The client sent a GET request (chunked request) with a Range header, and the server completed it.

3xx - Redirect

The client browser must take additional action to fulfill the request. For example, the browser may have to request a different page on the server, or repeat the request through a proxy server.

· 300 - Multiple Choices The document requested by the client can be found in more than one location, and these locations are listed in the returned document. If the server wants to propose a preference, it should indicate it in the Location response header.

· 301 - Moved Permanently The document requested by the client is elsewhere. The new URL is given in the Location header, and the browser should automatically access the new URL.

· 302 - Found Similar to 301, but the new URL should be considered a temporary replacement rather than a permanent one. Note that the corresponding status message in HTTP 1.0 is "Moved Temporatily". When this status code occurs, the browser can automatically access the new URL, so it is a useful status code. Note that this status code can sometimes be used interchangeably with 301. Some servers return 301, while others return 302. Strictly speaking, we can only assume that the browser will automatically redirect only if the original request was a GET. See 307.

· 303 - See Other Similar to 301/302, except that if the original request is POST, the redirect target document specified by the Location header should be extracted via GET.

· 304 - Not Modified The client has a buffered document and issued a conditional request (usually providing an If-Modified-Since header to indicate that the client only wants documents that are newer than the specified date). The server tells the client that the original buffered document can continue to be used.

· 305 - Use Proxy The document requested by the client should be retrieved through the proxy server specified by the Location header (new in HTTP 1.1).

· 307 - Temporary Redirect is the same as 302 (Found). Many browsers will incorrectly redirect with a 302 response, even if the original request was a POST, even though it can actually only redirect if the response to a POST request is a 303. For this reason, HTTP 1.1 added 307 to more clearly distinguish between several status codes: when a 303 response occurs, the browser can follow redirected GET and POST requests; if it is a 307 response, the browser can only follow Redirection of GET requests.

4xx - Client Error

These status codes indicate that something may have gone wrong with the request, which has prevented the server from processing the request.

· 400 - Bad Request The server does not understand the syntax of the request.

· 401 - Unauthorized The request requires authentication. After logging in, the server may return this response to the page. The response will contain a WWW-Authenticate header, and the browser will display the username/password dialog box accordingly, and then make the request again after filling in the appropriate Authorization header. IIS defines a number of different 401 errors that indicate a more specific cause of the error. These specific error codes appear in the browser but not in the IIS logs:

· 401.1 - Login failed.

· 401.2 - Server configuration caused login failure.

· 401.3 - Not authorized due to ACL restriction on resource.

· 401.4 - Filter authorization failed.

· 401.5 - ISAPI/CGI application authorization failed.

· 401.7 – Access is denied by the URL authorization policy on the web server. This error code is specific to IIS 6.0.

· 403 - Forbidden The server refused the request. Usually caused by the permission settings of files or directories on the server. Access Forbidden: IIS defines a number of different 403 errors that indicate a more specific cause of the error:

· 403.1 - Execution access is forbidden.

· 403.2 - Read access prohibited.

· 403.3 - Write access prohibited.

· 403.4 - Require SSL.

· 403.5 - SSL 128 required.

· 403.6 - IP address denied.

· 403.7 - Client certificate required.

· 403.8 - Site access denied.

· 403.9 - Too many users.

· 403.10 - Invalid configuration.

· 403.11 - Password change.

· 403.12 - Access to mapping table denied.

· 403.13 - Client certificate revoked.

· 403.14 - Directory listing denied.

· 403.15 - Client access permission exceeded.

· 403.16 - Client certificate is not trusted or invalid.

· 403.17 - The client certificate has expired or is not yet valid.

· 403.18 - The requested URL cannot be executed in the current application pool. This error code is specific to IIS 6.0.

· 403.19 - CGI cannot be performed for clients in this application pool. This error code is specific to IIS 6.0.

· 403.20 - Passport login failed. This error code is specific to IIS 6.0.

· 404 - Not Found The server cannot find the requested web page. For example, the server typically returns this code if the request is for a page that does not exist on the server.

· 404.0 - (None) – File or directory not found.

· 404.1 - The Web site cannot be accessed on the requested port.

· 404.2 - The request is blocked by the Web Services extension locking policy.

· 404.3 - This request is blocked by MIME mapping policy.

· 405 - Method Not Allowed The request method (GET, POST, HEAD, DELETE, PUT, TRACE, etc.) is not applicable to the specified resource, and the HTTP verb used to access this page is not allowed (the method is not Allow)

· 406 - Not Acceptable The specified resource has been found, but its MIME type is incompatible with the one specified by the client in the Accpet header. The client browser does not accept the MIME type of the requested page.

· 407 - Proxy Authentication Required This status code is similar to 401 (Unauthorized), but specifies that the requester should use a proxy for authorization. If the server returns this response, the server also indicates the proxy that the requester should use.

· 408 - Request Timeout The client has not issued any request within the waiting time allowed by the server. The client can repeat the same request later.

· 409 - Conflict The server encountered a conflict while completing the request. The server must include information about the conflict that occurred in the response. The server may return this code when responding to a PUT request that conflicts with a previous request, providing a list of differences between the two requests.

· 410 - Gone The requested document is no longer available, and the server does not know which address to redirect to. The difference between it and 404 is that returning 407 means that the document has permanently left the specified location, while 404 means that the document is unavailable for unknown reasons.

· 411 - Length Required (valid length required) The server will not accept a request containing an invalid Content-Length header field unless the client sends a Content-Length header.

· 412 - Precondition Failed Some preconditions specified in the request header failed.

· 413 – Request Entity Too Large The target document is larger than the server is currently willing to handle. If the server thinks it can handle the request later, it should provide a Retry-After header.

· 414 - Request URI Too Long The URI is too long.

· 415 – Unsupported media type.

· 416 – Requested Range Not Satisfiable The server cannot satisfy the Range header specified by the client in the request.

·417 – Execution failed.

· 423 – Locking error.

5xx - Server Error

These status codes indicate that an internal error occurred while the server was trying to process the request. These errors may be errors on the server itself rather than an error in the request.

· 500 - Internal Server Error The server encountered an error and was unable to complete the request.

· 500.12 - The application is busy restarting on the web server.

· 500.13 - The web server is too busy.

· 500.15 - Direct requests to Global.asa are not allowed.

· 500.16 – Incorrect UNC authorization credentials. This error code is specific to IIS 6.0.

· 500.18 – URL authorization store cannot be opened. This error code is specific to IIS 6.0.

· 500.100 - Internal ASP error.

· 501 - Not Implemented The server does not have the functionality to complete the request. For example, the server may return this code when the request method is not recognized by the server.

· 502 - Bad Gateway The server, acting as a gateway or proxy, received an invalid response from the upstream server.

· 502.1 - CGI application timed out.

· 502.2 - CGI application error.

· 503 - Service Unavailable The server is currently unavailable (due to overload or downtime for maintenance). Often, this is a temporary state.

· 504 - Gateway Timeout The server, acting as a gateway or proxy, did not receive the request from the upstream server in time.

· 505 - HTTP Version Not Supported The server does not support the HTTP protocol version used in the request.

The above is the detailed content of What are the HTTP response status codes?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template