What do you understand by the HTTP Status Codes ?
The HTTP or the HyperText Transfer Protocol is a protocol of the application layer. It helps in establishing communication between a web browser and a web server. When a client requests any information, the browser sends a response using numeric status codes. These status codes are in the form of 3-digit numbers ranging from 100 – 599. The client then acts on the response accordingly. The client may not always fully understand the status code or the response but may understand the nature/class of the response by seeing the leftmost/first digit of the numeric status code.
The HTTP status codes can be categorized into five standard classes using their first digit:
- 1xx – This stands for an informational response, that is, the request was received, continuing process, and should wait for the final response.
- 2xx – This stands for a successful response, that is, the request was successfully received, understood, and accepted.
- 3xx – This stands for redirection response, that is, some further action needs to be taken in order to complete the request.
- 4xx – This stands for client error, that is, the request contains bad syntax or cannot be fulfilled.
- 5xx – This stands for server error, that is, the server failed to fulfill an apparently valid request.
The other two digits have no such significant role when defining the classes.
A few examples of each class of status code have been mentioned below:
- 101 – Switching Protocols – It means the server has been asked to switch protocols and the server has agreed to do so.
- 102 – Processing – It means that the request may contain many sub-requests like file operations, which may take a long time to complete. This helps in preventing the client from assuming that the request has timed out.
- 200 – OK – This is a standard response to all the successful HTTP requests.
- 202 – Accepted – This means that the request has been accepted by the server and is not completed yet.
- 307 – Temporary Redirect – This means that the current request that is being sent to the server should be repeated with another URL. The future requests would still be sent to the original URL.
- 308 – Permanent Redirect – Unlike the previous one, here the current and all the future requests will be redirected to another given URL.
- 404 – Not Found – This means simply that the request been sent has not been found but it might be available in the future.
- 424 – Failed Dependency – It means the request failed because it depended on another request and that request also failed.
- 500 – Internal Server Error – A standard error message when some unexpected situation occurs and the server doesn’t exactly know what it is.
- 504 – Gateway Timeout – This means that the server did not receive a response in time.
Please Login to comment...