HTTP common status? reprinted and unsorted

Source: Internet
Author: User

Concept 1: What is the HTTP status code?

If you send a request to the server where the website is located to display a specific webpage (for example, when a user accesses the webpage through a browser or when se crawls the webpage ),

Then, the server where the website is located will return the HTTP status code to respond to this request.

 

1xx message

This type of Status Code indicates that the request has been accepted and must be processed.

This type of response is a temporary response. It only contains the status line and some optional response header information and ends with a blank line.

Because no 1xx status code is defined in HTTP/1.0, the server prohibits sending 1xx responses to such clients unless in some test conditions.

 

2XX successful

This type of Status Code indicates that the request has been successfully received, understood, and accepted by the server.

 

3xx redirection

This type of Status Code indicates that the request can be completed only after the client takes further operations.

These status codes are usually used for redirection, and subsequent request addresses (redirection targets) are specified in the location domain of this response.

If the method used for subsequent requests is get or head, the user's browser can automatically submit the required subsequent requests without user intervention.

The client should automatically monitor infinite loop redirection (for example, a-> A, or a-> B-> C-> ), this results in a large amount of unnecessary resource consumption on servers and clients.

According to the HTTP/1.0 standard, the browser should not automatically access the redirection for more than five times.

 

4xx request Error

This type of Status Code indicates that an error may occur on the client, which hinders server processing.

Unless a head request is returned, the server should return an entity that interprets the current error and whether it is temporary or permanent.

These Status Codes apply to any request method. The browser should show users any entity content contained in such error responses.

If the client is transmitting data when an error occurs, the TCP server implementation should carefully ensure that before closing the connection between the client and the server,

The client has received a packet containing the error message.

If the client continues to send data to the server after receiving the error message, the TCP stack of the server will send a reset packet to the client,

To clear all unknown input buffers from the client, so that the data is not read by the application on the server and interfere with the latter.

 

5xx Server Error

This type of Status Code indicates that an error or an exception occurs when the server processes the request,

The server may realize that the current hardware and software resources cannot process the request.

Unless this is a head request, the server should contain an entity that interprets the current error status and whether the situation is temporary or permanent.

The browser should show the User Any entity contained in the current response.

 

Concept 2: Common HTTP Status Codes

 

200

The request is successful, and the desired response header or data body will be returned with this response.

Conclusion: The server returns to the webpage successfully.

 

301

The requested resource has been permanently moved to a new location. In the future, any reference to this resource should use one of the several Uris returned in this response. If possible, clients with the link editing function should automatically change the requested address to the address returned from the server. This response can be cached unless otherwise specified.

The new permanent URI should be returned in the response location domain. Unless this is a head request, the response entity should contain hyperlinks and brief descriptions pointing to the new Uri.

If this is not a get or head request, the browser prohibits automatic redirection unless it is confirmed by the user because the request conditions may change. Note: For Some browsers that use the HTTP/1.0 protocol, when the post requests they send receive a 301 response, the next redirect request will become the get method.

 

Summary: Permanent website redirection

 

302

The requested resource now temporarily responds to the request from different Uris. As such redirection is temporary, the client should continue to send future requests to the original address. This response can be cached only when cache-control or expires is specified. The new temporary URI should be returned in the response location domain. Unless this is a head request, the response entity should contain hyperlinks and brief descriptions pointing to the new Uri.

 

Summary: temporary website redirection

 

401

The current request requires user authentication. The response must contain a WWW-Authenticate header for the requested resource to ask for user information. The client can submit a request that contains the appropriate authorization header information. If the current request already contains the authorization certificate, then the 401 response indicates that the server authentication has rejected those certificates. If the 401 response contains the same authentication request as the previous response, and the browser has tried verification at least once, the browser should display the entity information contained in the response to the user, this entity information may contain diagnostic information.

Conclusion: unauthorized access-unauthorized access to data from the client

 

 

403

The server has understood the request but refused to execute it. Different from 401 responses, authentication cannot provide any help and the request should not be submitted repeatedly. If this is not a head request and the server wants to clarify why the request cannot be executed, the reason for rejection should be described in the entity. Of course, the server can also return a 404 response, if it does not want the client to obtain any information.

 

Summary: The server rejects the request.

 

404

The request failed. The requested resources were not found on the server. No information can tell the user whether the situation is temporary or permanent. If the server knows the situation, it should use the 410 status code to inform the old resource that it is permanently unavailable due to some internal configuration mechanism problems, and there is no jump address. 404 this status code is widely used when the server does not want to reveal why the request is rejected or no other suitable response is available.

 

In a word, 404 indicates temporary, and 410 indicates permanent.

 

413

The server rejects the current request because the size of the physical data submitted by the request exceeds the scope that the server is willing to or can handle. In this case, the server can close the connection to prevent the client from sending this request.

 

In a word, the server rejects the request because the data volume is too large.

 

500

The server encountered an unexpected situation, causing it to fail to process the request. Generally, this problem occurs when the program code on the server fails.

 

In a word, the server encounters an error and cannot complete the request.

 

 

Common HTTP Status Codes

 

When accessing a webpage, I often encounter HTTP status responses. I only know the most basic information. Today I see a complete introduction. I will post it for you to see it. If you forget it, you can also take a look.

 

100 continue

The initial request has been accepted, and the customer should continue to send the rest of the request

 

101 switching protocols

The server converts a client-compliant request to another protocol.

 

200 OK

Everything is normal. The response documents for get and post requests follow

 

201 created

The server has created a document and the location header provides its URL.

 

202 accepted

The request has been accepted, but the processing has not been completed.

 

203 non-authoritative information

The document has been returned normally, but some response headers may be incorrect because the copy of the document is used.

 

204 NO content

If no new document exists, the browser should continue to display the original document. This status code is useful if the user regularly refreshes the page and the servlet can determine that the user document is new enough.

 

205 reset content

There is no new content, but the browser should reset the content it shows. Used to force the browser to clear the input content of the form

 

206 partial content

The client sends a GET request with a range header, and the server completes the request.

 

300 multiple choices

Documents requested by the customer can be found in multiple locations, which are listed in the returned documents. If the server needs to give priority, it should be specified in the location response header.

 

301 moved permanently

The document requested by the customer is elsewhere. The new URL is provided in the location header, and the browser should automatically access the new URL.

 

302 found

Similar to 301, but the new URL should be treated as a temporary alternative, rather than permanent.

 

303 see other

Similar to 301/302, the difference is that if the original request is post, the redirection target document specified by the location header should be extracted through get

 

304 not modified

The client has a buffered document and sends a conditional request (generally, the IF-modified-since header is provided to indicate that the customer only wants to update the document on a specified date ). The server tells the customer that the original buffer documentation can still be used.

 

305 use proxy

The document requested by the customer should be extracted from the proxy server specified by the location header

 

307 temporary redirect

It is the same as 302 (found. Many browsers mistakenly respond to the 302 response for redirection. Even if the original request is post, it can only be redirected when the POST request actually responds to 303. For this reason, HTTP 1.1 adds 307 to clear the region code in several states: When a 303 response occurs, the browser can follow the redirected get and post requests; if a 307 response occurs, the browser can only follow the redirection to get requests.

 

400 bad request

The request has a syntax error.

 

401 unauthorized

The customer attempted to access the password-protected page without authorization. The response contains a WWW-Authenticate header. the browser displays the username/password dialog box accordingly, and then sends a request again after entering the appropriate authorization header.

 

403 Forbidden

Resource unavailable.

 

404 not found

The specified resource cannot be found.

 

405 method not allowed

Request methods (get, post, Head, delete, put, Trace, etc.) are not applicable to specified resources.

 

406 not acceptable

The specified resource has been found, but its MIME type is incompatible with the one specified by the customer in the accpet header.

 

407 proxy authentication required

Similar to 401, the customer must first be authorized by the proxy server.

 

408 request timeout

The customer has not issued any request within the waiting time of the server license. The customer can repeat the same request later.

 

409 conflict

It is usually related to put requests. The request cannot be successful because the request conflicts with the current status of the resource.

 

410 gone

The requested document is no longer available and the server does not know which address to redirect. It differs from 404 in that if 407 is returned, the document permanently leaves the specified position, and 404 indicates that the document is unavailable for unknown reasons.

 

411 length required

The server cannot process the request unless the client sends a Content-Length header.

 

412 precondition failed

Some prerequisites specified in the request header fail.

 

413 Request Entity too large

The size of the target document exceeds the size that the server is willing to process. If the server thinks it can process the request later, it should provide a retry-after Header

 

414 request URI Too Long

Uri is too long

 

416 requested range not satisfiable

The server cannot meet the range header specified by the customer in the request.

 

500 Internal Server Error

The server encountered unexpected circumstances and could not complete the customer's request

 

501 not implemented

The server does not support the functions required to implement the request. For example, the customer sends a put request not supported by the server.

 

502 Bad Gateway

When the server acts as a gateway or proxy, in order to complete the request to access the next server, but the server returns an INVALID RESPONSE

 

503 service unavailable

The server fails to respond due to maintenance or heavy load. For example, Servlet may return 503 when the database connection pool is full. A retry-after header can be provided when the server returns 503

 

504 gateway timeout

Used by a proxy or gateway server, indicating that the remote server cannot receive a response in a timely manner.

 

505 HTTP Version Not Supported

The server does not support the HTTP Version specified in the request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.