Notes illustrates HTTP (d) - HTTP status code

The main content of this chapter is to understand the working mechanism of HTTP status codes

Duty status code when the result is to request the client sends a request to the server, the returned description. With state code, we can understand this request if the server has been properly treated.

Status code from which can be divided into five or more including:

category The reason phrase
1XX Informational (informational status codes) Accepted request is being processed
2XX Success (success status code) Normal requests processed
3XX Redirection (Redirect Status Code) Additional operation required to complete the request
4XX Client Error (Client Error Status Code) The server can not process the request
5XX Server Error (server error status code) Server processes the request error

Here's what some common status codes.

A, 2XX success

1.1 200 OK

It represents a client sends a request from the server is processed normally.

1.2 204 No Content

The status code indicates a request sent by a client has been normally processed in the server, but the content is not returned response packet is not included in the entity body portion.

General information is sent to the server in just from the client and the server does not need to use when sending content to the client.

1.3 206 Partial Content

The status code indicates a range of client requests, and the server-side implementation of this part of the GET request. Response message includes the content of the Content-Range entity specified range.

Two, 3XX redirection

3XX response status code indicates that the browser needs to perform some special process to correctly process the request.

2.1 301 Moved Permanently

Permanent Redirect.

The status code indicates the requested resource has been assigned a new URI, the resources should be used after the specified URI. The new URI will specify the response header Location header field in HTTP.

2.2 302 Found

Temporary Redirect.

This status code indicates that the request resource is allocated to a new URI, the user desired (present) can be used to access the new URI resource.

And 302 Moved Permanently similar status code, but not the resource 302 represents a permanent redirection is only temporary in nature.

2.3 303 See Other

The status code indicates the presence of a different URI corresponding to the request resource, to be acquired using the GET method for directing resource request.

303 status code 302 Found status code and have similar functions, but the 303 status code indicates that the client should adopt clear GET method to obtain resources.

When the response status code 302, 303, almost all browsers will change the POST GET, and remove the body of the request in the message, after the request is automatically sent again.

301, 302 standard is prohibited POST way into the GET method, but actually we all do.

2.4 304 Not Modified

The status code indicates when the client sends a request conditional (GET request containing If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since any one portion) server allows access requesting access to resources, but because the request did not meet the conditions, the 304 not Modified redirection, direct use of client-side caching of resources.

2.5 307 Temporary Redirect

Temporary Redirect.

The 302 Found status code and have the same meaning, even though 302 standard prohibits become POST GET, but actual use is still doing so.

307 will follow the standard browser will not turn into GET from POST . But for dealing with the behavior of the request, different browsers will still different situation.

Three, 4XX client error

4XX results indicate that the client is the reason why the error occurred.

3.1 400 Bad Request

The status code indicates a syntax error in the request packet. When an error occurs, the need to modify the requested content transmission request again.

3.2 401 Unauthorized

This status code indicates that the request needs to be authenticated.

3.3 403 Forbidden

This status code indicates that the resource access request is rejected by the server, the server does not need to give detailed reasons, but may be described in the body of the response message entities.

3.4 Not Found

This status code indicates that the request can not find the resources on the server.

Four, 5XX server error

The results show that the response of the server itself 5XX error has occurred.

4.1 500 Internet Server Error

This status code indicates that the server when there is an error in the execution of the request, there may exist a Web application bug or some temporary failure.

4.2 503 Service Unavailable

This status code indicates that the server is temporarily in overloaded or down for maintenance in progress, now unable to handle the request.

Guess you like

Origin www.cnblogs.com/DM428/p/11203706.html