HTTP status codes#
So we've fetched information from the remote web server and we've even sent some too. That's been fun to see in action but what if you request something from a web server that doesn't exist? What happens if you ask for a file, say an image, that isn't there?
You get an
HTTP 404 Not Found status code.
The HTTP protocol has a lot of status code. Not a crazy amount, but enough that you'll want to only really remember a few of the important ones. That being said here's a link to all of the current codes: https://www.iana.org/assignments/http-status-codes/http-status-codes.txt.
Let's look at a few important notes.
Firstly, look at this part of the above link:
1 2 3 4 5
HTTP status codes, as you can see, are numbers. They start with (at the time of writing):
5. Each are three digits long. The starting digit decides what the code is going to be for, as shown below:
| ||Informational - Request received, continuing process|
| ||Success - The action was successfully received, understood, and accepted|
| ||Redirection - Further action must be taken in order to complete the request|
| ||Client Error - The request contains bad syntax or cannot be fulfilled|
| ||Server Error - The server failed to fulfill an apparently valid request|
You may already actually know of a very common HTTP Status Code:
404 Not Found.
Here are the most common status codes you'll see:
301 Moved Permanently
303 See other
404 Not Found
405 Method Not Allowed("Method" referring, of course, to the HTTP method
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
All the codes will be around, but they're no where near as common as the above codes.