Introduction to HTTP Status Codes

Source: Internet
Author: User
HTTP and Status Codes

HTTP is a hypertext transfer protocol. The browser communicates with the Web server over HTTP (some other software, such as Im, uses the HTTP protocol to transmit data), transmits our request (HTTP request) to the server, and the server responds to this request, return the HTTP Response and the data we need. This is basically what it looks like.

If we request something, the server will return something, so HTTP status codes is not needed. But things are often not that simple. For example, if we request a webpage, but the server does not, or the webpage is transferred to another place, or the server disallows us to view the webpage, therefore, in order to facilitate the browser to handle these correct and incorrect situations, HTTP uses status codes to indicate that the request (HTTP request) is processed on the server. Status Codes returns the response to the browser through HTTP response. The browser will handle the response accordingly.

HTTP status codes Classification

Since there are both correct and wrong statuses, does HTTP define two types of status codes? People develop agreements, but experts (unlike me) think more carefully than we do. Five major types of status codes are defined in HTTP 1.1:

Informational
Meaning: Information
Range: 1xx

Successful
Meaning: Successful
Range: 2XX

Redirection
Meaning: Redirection
Value Range: 3xx

Client Error
Meaning: client errors
Range: 4xx

Server Error
Meaning: Server Error
Range: 5xx

Look at how thoughtful people think. Real experts are real experts.

Introduction to common HTTP Status Codes

Next we will briefly introduce the HTTP status codes that we often encounter.

It may be that I am ignorant. I often encounter a few HTTP status codes.

Successful
200-OK: OK
This is the most common one (we may not see it directly, but if you use some packet capture tools, most HTTP responses have this ). The meaning is very simple, that is, the server receives and understands the client requests and processes them normally.
206-partial content: Partial content.
This also happens frequently. It is easy for everyone to publish messages.
In layman's terms, if the client requests a part of the content of the document (image, text, sound, etc.) and the server processes the content normally, 206 is returned. In general, in addition to specifying the request content, it also specifies the offset and length.
Some content, right? This is why many browsers and software support resumable data transfer. Haha, don't be afraid to see 206 in the future.

Redirection
301-moved permanently: permanently moved.
This status code indicates that the resources requested by the client have been permanently transferred to a new place. This response (HTTP Response) also contains the new address of the resource. It tells the client that if you want this resource again next time, you can use the new address to retrieve it.
302 found: Temporary redirection.
This status code indicates that the resources requested by the client are temporarily put in a new place. The response also contains the new address of the resource.
307-temporary redirect: Temporary redirection. (If we don't implement the Protocol or perform related development, we can roughly understand it as much as 302)
There is an article about redirectionArticleViewing 302 redirection from business.com is very interesting
We reproduced a copy, address: http://bbs.netpu.net/viewthread.php? Tid = 810

Client Error
400-bad request: Incorrect request
The request syntax is incorrect and cannot be understood by the server.
401-unauthorized: unauthorized
When the server returns 401 code, it indicates that the client must be authorized by the server before accessing the specified resource.
403-Forbidden: Access prohibited
That is, access to some resources is not allowed.
404-not found: not found
Client request content not found

Server Error
500-Internal Server Error
Internal Server error.

Official materials:
Http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

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.