diff --git a/includes/common.inc b/includes/common.inc
index da8996a1b9..c9a4b5a6a0 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -92,6 +92,13 @@ define('JS_THEME', 100);
 define('HTTP_REQUEST_TIMEOUT', -1);
 
 /**
+ * Error code indicating that the request returned an empty response.
+ *
+ * @see drupal_http_request()
+ */
+define('HTTP_REQUEST_EMPTY_RESPONSE', -2);
+
+/**
  * @defgroup block_caching Block Caching
  * @{
  * Constants that define each block's caching state.
@@ -988,6 +995,13 @@ function drupal_http_request($url, array $options = array()) {
     $result->error = 'request timed out';
     return $result;
   }
+
+  if (strlen($response) === 0) {
+    $result->code = HTTP_REQUEST_EMPTY_RESPONSE;
+    $result->error = 'empty response';
+    return $result;
+  }
+
   // Parse response headers from the response body.
   // Be tolerant of malformed HTTP responses that separate header and body with
   // \n\n or \r\r instead of \r\n\r\n.
