As the basis of web services, HTTP protocol should be taken seriously, but colleagues around the world can clearly understand the rare issue of HTTP protocol. Since it is the foundation, we should be able to master it earlier, so we have been using it for nearly half a year (January 1, June 2016)
As the basis of web services, HTTP protocol should be taken seriously, but colleagues around the world can clearly understand the rare issue of HTTP protocol. Since it is the foundation, we should be able to master it a little earlier, so we are not prepared to learn new technologies in the last six months (June-June. The first thing is to review the books I have read in 2015, so that I can check for missing information. After reading it, focus on the following book orders.
They are:
1. Introduction to Algorithms
2. HTTP authoritative guide
3. "TCP/IP details Volume 1: Protocol"
4. details of TCP/IP II: Implementation
5. TCP/IP details 3: TCP transaction protocol. HTTP and UNIX domain protocol
6. Data structure and algorithm analysis (in C language)
I think these books have been enough for half a year. After the Chinese New Year, Tianji has been reading graphic HTTP. This book is easy to understand and contains some difficult concepts. the language itself has already been clearly described, however, if you want to understand the HTTP protocol, you are advised to purchase this book. But for further research, we recommend the HTTP authoritative guide. In fact, the better way is to gradually read the graphic HTTP first, so as not to be scared away by obscure concepts, you can go deep into the HTTP authoritative guide.
The following describes the HTTP status code.
Before introducing the status code, let's briefly explain why there is a status code. Communication between computers is based on the protocol. both the client and server communicate according to the protocol. The HTTP status code is defined in the HTTP protocol. After the client requests the server, the server returns the result and the status code. Tell the client whether the request is successful or failed, or what operations should be performed by the client. Why not use text status codes? Isn't it clearer and more intuitive? This is because these status protocols have already stipulated that the status code indicates the status of this article. Think of a joke to help you understand the status code:
In an alien family, people often tell jokes instead of telling jokes. Instead, they simply say numbers. a single number represents a joke. One day a young handsome guy came from Earth and fell in love with this girl, so he went to his house to visit. After dinner, the planet is popular with jokes, and drinking tea after meals on Earth is a truth.
His grandfather said: 404;
Everyone laughed.
Grandma said: 200;
Everyone can't help it.
His girlfriend said: 502;
Everyone laughed and shed tears.
When he got to him, he suddenly lost his mind, so he made a random number, so let's get 500. All people smile at each other, but they cannot.
He had no idea. he asked everyone why they were funny. My girlfriend said: there is only one joke book on our planet, and everyone is familiar with it. so when we mention a number, it is a joke and we all know it. But in our joke, there is no 500 number.
This is the truth, so it is represented by a status code.
There are not many common status codes, and there are about 14.
1 ** is a class status code called Information status, indicating that Information is being processed.
The two ** status codes are called Success status codes, indicating that the request is completed normally.
The 3 ** class status code is called the Redirection status code, indicating that the client needs to perform additional operations (such as Redirection. Redirection)
4 ** class status codes are called Error status codes, which are usually caused by client errors.
The *** class status code is usually caused by a Server Error.
Summary: status codes include client error status codes, server error status codes, success status codes, and redirection status codes.
1. 2 ** type status codes
1. 200 OK indicates that the request sent from the client has been correctly processed by the server and sent back.
2. the 204 No Content request is successful, but No result (entity) is returned ). The php die () exit () function usually triggers a 204 status code.
3. request status code in the range of 206 Partial Content.
What is a range request. You can see it.
Some parts of the beauty map are not loaded completely. In fact, loading images on the Internet is a range request. An image may have a size of 1024 KB. if it is loaded at a time, the page rendering speed will be very slow, but the rendering speed will be poor. After the asynchronous range request is executed, the image of K is loaded each time, and then rendered and spliced in sequence. the loading speed is much faster.
The above 206 value is that the http request executes a range request and only obtains some resources.
2. 3 ** status codes
1. the 301 status code Moved Permanently indicates that the requested page resource has now been transferred. you need to go to a new place to find the page. This is redirection. the location field value is displayed in the server's response header.
2. the status code 302 (Found) is not as bad as the status code 301. It indicates that the requested page resource has now been transferred, and you need to search for it in a new place. However, the new place is not fixed. it may take a few days to change. You are not prompted to save the bookmarks.
3. status code 303. See other. indicates that the requested page contains the address you want to obtain the resource. For example, if you go to the doorman to get the courier and arrive at the guard, the Lord said the courier has been handed over to the front desk. The status code 303 is returned for this process.
4. 304 Not Modified indicates that the resource has been found, but it is Not updated compared with the previous one. The browser reads the cache.
5. 307 Temporary redirection of Temporary Redirect.
3: 4 ** client errors.
1. 400 Bad Request Message Syntax error.
2. 401 Unauthorized must pass HTTP authentication (BASIC or DIGEST ).
3. This status code is reported when the Forbidden directory or file permission error occurs.
4. this resource is unavailable on the 404 server. Generally, the path is incorrect.
4: 5 ** server errors.
1. 500 Internal Server Error: The Server Error may be caused by a WEB application Error.
2. 503 the Serveice Unavailable server is overloaded.
There is no need to memorize these things. You can check the document when using it. This is also the reason why I wrote this blog: leave this deposit card for emergency purposes.
All my blog articles are original. Some articles may reference relevant materials, but all of them have clear source information. You can reprint and share them at will, but you need to add a link to this article and a copyright description.