HTTP stands for Hyper Text Transfer Protocol. This is an application level protocol used for serving web pages with the help of different web servers.
When a Web server respond to any request from a browser or any web client, the response consists of status line, some reponse headers, a blank line and a document. Example:

HTTP/1.1 200 OK
Content-Type: text/plain

Hello Everyone

The status line consists of HTTP version, an integer that is known as status code and very short message corresponding to status code. Content-type is something which tells you the MIME type of the document (This header is not optional as most of are). Most of them contains document leaving few.

The main purpose of status codes is to give a small description about the status of the request which client had made to the server.

The status codes are differentiated between five classes which could be identified with the first digit of the status code:

  1. 1xx – Informational
  2. 2xx – Success
  3. 3xx – Redirection
  4. 4xx – Client error
  5. 5xx – Server error

1xx Informational – These status codes indicates a provisional reponse and contains status line, optional headers and is terminated by empty line. In this status code, the requester is required to take action to continue. Following are the status codes which fall under this cateogery:

  1. 100 Continue – This means that the server had received the first part of the request (request headers) and the client should continue with the rest of the request (request body).
  2. 101 Switching protocols – Just tells the client that the server will switch protocols reading the UPGRADE message header field during the current connection.

2xx Success – This class of status codes indicated that the request made by client is successfully received, understood and accepted. Following are the status codes which fall under this cateogery:

  1. 200 OK – This simply means that the request by the client is successfully accepted by the server.
  2. 201 Created – The request is fulfilled and resulted in a new resource being created.
  3. 202 Accepted – The server had accepted the request but hasn’t yet processed it.
  4. 203 Non-Authoritative Information – Server successfully processed the request but is returning information that may be from another source means the returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy.
  5. 204 No Content – As the name tell that the request is successfully processed by the server but it didn’t return any content.
  6. 205 Reset Content – This means that the server has fulfilled/processed the request but the user agent should reset the document view (like clearing a form for new input) which caused the request to be sent.
  7. 206 Partial Content – This means that the server had fulfilled the partial GET request for the resource. This thing is normally used in downloading tools like wget to split download into parts or to resume a interrupted download.

3xx Redirection – These means that the client/user-agent must take further action to fulfill the request. These status codes are used for redicrection normally. A user-agent should not automatically redirect more than 5 times as such redirections usually ends in infinite loops. The status codes in this cateogery are given below:

  1. 300 Multiple Choices – Indicated multiple options for the resurce that a client could follow. This is normally used like getting a video depending on the connection speed client is using …. getting a page depeding on the location of the client and server.
  2. 301 Moved Permanently – This means that this resource had been moved to different URI which is given to the client by the server and the new URI should be used for all the future references for this resource.
  3. 302 Found – The requested resource is found under different URI/location but the client should continue to use the original URI.
  4. 303 See Other – This means that the response to the request is found under different location/URI and should be retrived from their with the GET request.
  5. 304 Not Modified – Means that the requested page has not modified from the last time it is requested. that means that the client can use the old cached page as it has not modified.
  6. 305 Use Proxy – Means that the requested resource can only be accessed by using the proxy specified in the location field. In this response the server will also give client that which proxy he should use.
  7. 306 – No longer in action.
  8. 307 Temporary Redirect – This one is same to the 301 but in this case the current request should use the new URI but the future ones could use the original URI.

4xx Client Error – These status codes are used in the cases when the client seems to be erred means there is an error in the request from the client due to which the server is unable to process the request. The following error codes fall under this cateogery:

  1. 400 Bad Request – The syntax of the request send by the client is not understood by the server.
  2. 401 Unauthorized – It’s much similar to 403 but specifically for use when authentication is possible but has failed or not yet been provided.
  3. 402 Payment required – This code has never been used till now. Reserved for future use.
  4. 403 Forbidden – The request from the client is fine and legal but the server is refusing to process/respond to the request.
  5. 404 Not Found – The document or file requested by the client is not found on the server.
  6. 405 Method Not Allowed – The method (like GET, POST) specified in the request is not allowed for the specified source.
  7. 406 Not Acceptable – Resource indicated generates a MIME type incompatible with that specified by the client via its Accept header.
  8. 407 Proxy Authentication Required – The status code is similar to 401 (Not authorized) but indicates that the client must first authenticate with proxy.
  9. 408 Request Timeout – The client failed to sent a request in the time allowed by the server.
  10. 409 Conflict – The server encountered a conflict fulfilling the request. The server must include information about the conflict in the response. Usually associated with PUT requests; used for situations such as trying to upload an incorrect version of a file.
  11. 410 Gone – Indicates that the resource requested is no longer available and will not be available again.Clients such as search engines should remove the resource from their indexes to prevent repeated requests.
  12. 411 Length Required – Server will not accept the request without a valid Content-Length header field.
  13. 412 Precondition Failed – A precondition specified in one or more Request-Header fields returned false.
  14. 413 Request Entity Too Large – The server is refusing to process a request because the request entity is larger than the server is willing or able to process.If the condition is temporary, the server SHOULD include a Retry-After header field to indicate that it is temporary and after what time the client MAY try again.
  15. 414 Request-URI Too Long – The request was unsuccessful because the URI specified is longer than the server is willing to process.
  16. 415 Unsupported Media Type – The request was unsuccessful because the entity of the request is in a format not supported by the requested resource for the method requested.
  17. 416 Requested Range Not Satisfiable – The client has asked for a portion of the file, but the server cannot supply that portion (for example, if the client asked for a part of the file that lies beyond the end of the file).
  18. 417 Expectation Failed – The server can’t meet the requirements of the Expect request-header field.
  19. 423 Locked – The resource that is being accessed is locked.
  20. 424 Failed Dependency – The request failed due to failure of a previous request.
  21. 426 Upgrade Required – The client should switch to TLS/1.0.
  22. 449 Retry With – A Microsoft extension. The request should be retried after doing the appropriate action.
  23. 450 Blocked – A Microsoft extension. Used for blocking sites with Windows Parental Controls.

5xx Server Error – These are the cases in which the server had encountered an error or incapable of performing/processing a valid request. Means the error is with server itself …. not with the request or client. These are the following status codes which fall under this cateogery:

  1. 500 Internal Server Error – The request was unsuccessful due to an unexpected condition encountered by the server.
  2. 501 Not Implemented – This is a very rare error. Comes when either the web client or the web server is old. This means that the server does not support the functionality required to fulfill the request.
  3. 502 Bad Gateway – The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
  4. 503 Service Unavailable – Means that the server is unable to handle the request (usually due to temporary overloading or maintenance of the server).
  5. 504 Gateway Timeout – The server was acting as a gateway or proxy and didn’t receive a timely request from the upstream server.
  6. 505 HTTP Version Not Supported – The server doesn’t support the HTTP protocol version specified in the request.


If you enjoyed this post, make sure you subscribe to my RSS feed!!!!

No related content found.