diff --git a/includes/common.inc b/includes/common.inc
index e9286f4..b2675fc 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -92,6 +92,12 @@ define('JS_THEME', 100);
 define('HTTP_REQUEST_TIMEOUT', 1);
 
 /**
+ * Error code indicating that the request made by drupal_http_request() exceeded
+ * the maximum allowed redirects without reaching the final target.
+ */
+define('HTTP_REQUEST_ALLOWED_REDIRECTS_EXHAUSTED', 2);
+
+/**
  * Constants defining cache granularity for blocks and renderable arrays.
  *
  * Modules specify the caching patterns for their blocks using binary
@@ -1000,6 +1006,10 @@ function drupal_http_request($url, array $options = array()) {
         $result->code = HTTP_REQUEST_TIMEOUT;
         $result->error = 'request timed out';
       }
+      elseif ($options['max_redirects'] <= 0) {
+        $result->code = HTTP_REQUEST_ALLOWED_REDIRECTS_EXHAUSTED;
+        $result->error = 'maximum allowed redirects exhausted';
+      }
       elseif ($options['max_redirects']) {
         // Redirect to the new location.
         $options['max_redirects']--;
