Handling HTTP responses
After receiving and processing a request, the server sends back a HTTP response message. These messages have a standardized structure. They contain a wealth of information, with the most important pieces being the status code, the headers, and the body.
HTTP status codes
The status code is a three-digit integer where the first digit represents the category, while the next two digits are used to define the subcategory. They are as follows:
- 1XX - Informational: Request was received. This indicates a provisional response.
- 2XX - Success: This is the most important response status, acknowledging that the request was successfully received, understood, and accepted. It's what we're looking for in our web-mining scripts.
- 3XX - Redirection: This class of status codes indicates that the client must take additional action. It usually means that additional requests must be made in order to get to the resource, so our scripts will have to handle this scenario. We also need to actively...