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

What are the HTTP response status codes?

May 16, 2023 am 08:37 AM
http

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

What is http status code 403? What is http status code 403? Oct 07, 2023 pm 02:04 PM

HTTP status code 403 means that the server rejected the client's request. The solution to http status code 403 is: 1. Check the authentication credentials. If the server requires authentication, ensure that the correct credentials are provided; 2. Check the IP address restrictions. If the server has restricted the IP address, ensure that the client's IP address is restricted. Whitelisted or not blacklisted; 3. Check the file permission settings. If the 403 status code is related to the permission settings of the file or directory, ensure that the client has sufficient permissions to access these files or directories, etc.

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS Sep 26, 2023 am 11:19 AM

How to use NginxProxyManager to implement automatic jump from HTTP to HTTPS. With the development of the Internet, more and more websites are beginning to use the HTTPS protocol to encrypt data transmission to improve data security and user privacy protection. Since the HTTPS protocol requires the support of an SSL certificate, certain technical support is required when deploying the HTTPS protocol. Nginx is a powerful and commonly used HTTP server and reverse proxy server, and NginxProxy

Send POST request with form data using http.PostForm function Send POST request with form data using http.PostForm function Jul 25, 2023 pm 10:51 PM

Use the http.PostForm function to send a POST request with form data. In the http package of the Go language, you can use the http.PostForm function to send a POST request with form data. The prototype of the http.PostForm function is as follows: funcPostForm(urlstring,dataurl.Values)(resp*http.Response,errerror)where, u

HTTP 200 OK: Understand the meaning and purpose of a successful response HTTP 200 OK: Understand the meaning and purpose of a successful response Dec 26, 2023 am 10:25 AM

HTTP Status Code 200: Explore the Meaning and Purpose of Successful Responses HTTP status codes are numeric codes used to indicate the status of a server's response. Among them, status code 200 indicates that the request has been successfully processed by the server. This article will explore the specific meaning and use of HTTP status code 200. First, let us understand the classification of HTTP status codes. Status codes are divided into five categories, namely 1xx, 2xx, 3xx, 4xx and 5xx. Among them, 2xx indicates a successful response. And 200 is the most common status code in 2xx

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files With the development of the Internet, the file download function has become one of the basic needs of many websites and applications. For scenarios where multiple files need to be downloaded at the same time, the traditional synchronous download method is often inefficient and time-consuming. For this reason, using PHP to download multiple files asynchronously over HTTP has become an increasingly common solution. This article will analyze in detail how to use PHP asynchronous HTTP through an actual development case.

Common network communication and security problems and solutions in C# Common network communication and security problems and solutions in C# Oct 09, 2023 pm 09:21 PM

Common network communication and security problems and solutions in C# In today's Internet era, network communication has become an indispensable part of software development. In C#, we usually encounter some network communication problems, such as data transmission security, network connection stability, etc. This article will discuss in detail common network communication and security issues in C# and provide corresponding solutions and code examples. 1. Network communication problems Network connection interruption: During the network communication process, the network connection may be interrupted, which may cause

See all articles