HTTP request and Response 3: status code

Source: Internet
Author: User
Tags error status code html form

The HTTP status code is divided into five main categories:
100~199: Information Tips
200~299: Success
300~399: redirect
400~499: Client Error
500~599: Server Error

Status codes provide a convenient way for clients to understand the results of a transaction, and a summary of each status code is given below.

100~199 ———— Informational Status code
Informational status codes are used for informational cues, and the defined informational status codes are as follows:
1) 100
Cause phrase: Continue
Meaning: The description received the initial part of the request, the client continues, after sending the status code, the server must respond after receiving the request. The client needs to send a expect request header with a value of continue, and the server receives a response with a status code of 100 and expects the client to send the request entity to the service side for processing.


2) 101
Cause phrase: Switching protocols
Meaning: The server is switching the protocol to the Protocol listed in the update header according to the client's specification
200~299 ———— Success Status code
The following is a defined status code that indicates success:
1) 200
Cause phrase: OK
Meaning: The request is not a problem, the body part of the entity contains the requested resource


2) 201
Cause phrase: Created
Meaning: For a request to create a server object, such as put, the server must create a good object before sending the status code


3) 202
Cause phrase: Accepted
Meaning: The request has been accepted, but the server has not performed any action on it, and there is no guarantee that the server will complete the request


4) 203
Cause phrase: non-authoritative information
Meaning: The entity header contains information that is not from the source-side server, but from a copy of the resource. This can occur if there is a copy of the resource on the intermediate node, but it cannot or does not validate the resource-related meta-information it sends.


5) 204
Reason phrase: No Content
Meaning: The response message contains several headers and a status line, but no body part of the entity. It is primarily used to update a browser without turning it into a new, real-world document.


6) 205
Reason phrase: Reset Content
Meaning: tells the browser to clear all HTML form elements in the current page


7) 206
Reason phrase: Partial Content
Meaning: The client can obtain some or a range of documents through some special headers, which indicates that the scope request was successful.
300~399 ———— REDIRECT Status code
The redirect status code is used to redirect the resource, and if the resource has been moved, a redirect status code and an optional location header can be sent to tell the client that the resource has been moved and where it can be found so that the browser can transparently move to the new position without disturbing the user.
1) 300
Cause phrase: multiple Choices
Meaning: When a client requests a URL that actually points to multiple resources, the status code is returned, following an example:
Request message:
Get/pet-products.txt http/1.1host:www.joes-hardware.comaccept: *
Server-side Response message redirection to another address:
http/1.1 301 Oklocation:http://www.gentle-grooming.com/content-length:56content-type:text/plain//body
After the client browser receives the redirected response message, it initiates a request to the new address:
Get/http/1.1host:www.gentle-grooming.comaccept: *
Response message for the new address:
http/1.1-okcontent-type:text/htmlcontent-length:3307 ...

2) 301
Cause phrase: Moved permanently
Meaning: Used when the requested URL has been removed. The location header of the response should contain the URL where the resource is now located


3) 302
Cause phrase: Found
Meaning: Similar to 301, however, the client should use the URL given by the location header to temporarily locate the resource, and future requests should still use the old URL


4) 303
Cause phrase: See other
Meaning: Informs the client that it should use another URL to obtain the resource, the new URL is located in the location header of the response message, and its primary goal is to allow the response of the POST request to target the client to a resource


4) 304
Cause phrase: not Modified
Meaning: The client can make its request conditional by the included request header, the client initiates a conditional get request, and the recent resource is not modified, it is possible to use this status code to indicate that the resource has not been modified, and that the response with this status code does not contain the body part of the entity.
Request message:
get/seasonal/index-fall.html http/1.1host:www.joes-hardware.comaccept: *if-modified-since:fri, Oct 3 1997 02:16:00 Gmt
If the resource has not been modified, the response message:
http/1.1 304 Not Modified ...

5) 305
Reason phrase: Use Proxy
Meaning: Used to indicate that a resource must be accessed through a proxy, the location of the agent is given


6) 307
Cause phrase: temporary Redirect
Meaning: Similar to 301, but the client should use the URL given by the location header to temporarily locate the resource, and future requests should use the old URL
400~499 ———— Client Error status code
Client Error status Code feedback client requests caused by errors, generally handled by the browser, only a small number of errors, such as 404, will be fed back to the user.
1) 400
Reason phrase: Bad Request
Meaning: Informs the client that it sent an incorrect request


2) 401
Cause phrase: unauthorized
Meaning: Returns with the appropriate header, in which requests the client to authenticate itself before obtaining access to the resource


3) 402
Cause phrase: Payment Required
Meaning: Not currently used, reserved


4) 403
Cause phrase: Forbidden
Meaning: Used to indicate that the request was rejected by the server


5) 404
Cause phrase: not Found
Meaning: The server could not find the requested URL


6) 405
Reason phrase: Method not allowed
Meaning: This status code is used when initiating a request with a method that is not supported by the requested URL. The Allow header is included in the response to tell the client which methods are available to the requested resource


7) 406
Cause phrase: not acceptable
Meaning: The client can specify parameters to describe what type of entity they are willing to receive, and when the server does not have a resource that matches the client's acceptable URL, use this code


8) 407
Reason phrase: Proxy authentication Required
Meaning: A proxy server that is similar to 401 but requires authentication of resources


9) 408
Reason phrase: Request Timeout
Meaning: After a timeout, the server can echo this status code and close the connection


10) 409
Cause phrase: Conflict
Meaning: Used to describe some of the conflicts that a request might cause on a resource


11) 410
Cause phrase: Gone
Meaning: Similar to 404, only the server has ever owned this resource, but this resource has been removed


12) 411
Reason phrase: Length Required
Meaning: The server requires that the Content-length header be included in the request message


13) 412
Cause phrase: precondition Failed
Meaning: The client initiates a conditional request and is used when one of the conditions fails. A conditional request is initiated when the client contains the expect header


14) 413
Reason phrase: Request Entity Too Large
Meaning: When a client sends an entity body part larger than the server can or wants to handle, use this status code


15) 414
Reason phrase: Request URI Too Long
Meaning: This status code is used when the request URL in the client's request is longer than the server can or wants to process


16) 415
Cause phrase: Unsupported Media Type
Meaning: This status code is used when the server does not understand or cannot support the content type of the entity that the client is sending


17) 416
Cause phrase: Requested Range not satisfiable
Meaning: The request message requests a range of the specified resource, and when this range is invalid or cannot be satisfied, use this status code


18) 417
Cause phrase: expectation Failed
Meaning: The requested expect request header contains an expectation, but when the server does not meet this expectation, use this status code 500~599 ———— Server Error status code
This alarm code will be included in the return paper when the server itself has an error.
1) 500
Reason phrase: Internal Server Error
Meaning: Server error


2) 501
Cause phrase: not implemented
Meaning: client-initiated requests exceed the capabilities of the server


3) 502
Cause phrase: Bad Gateway
Meaning: A server that is used as a proxy or gateway receives a pseudo-response from the next link on the request response chain


4) 503
Cause phrase: Service unavailable
Meaning: Used to indicate that the server is temporarily unable to service the request, can contain a retry-after header, tell the client when the resource is available


5) 504
Reason phrase: Gateway Timeout
Meaning: The response came from the gateway or proxy and timed out while waiting for the other server to respond to its request


6) 505
Cause phrase: HTTP Version not supported
Meaning: The request received by the server uses a protocol version that it cannot or is unwilling to support

HTTP request and Response 3: status code

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.