diff --git a/includes/common.inc b/includes/common.inc
index e791deca2b3074313aa134030c9e5e6687929d24..7a61a7512bf0d3bbc6991e44682549e9a9f05e15 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -436,13 +436,13 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
   // Parse the URL and make sure we can handle the schema.
   $uri = parse_url($url);
 
-  if (!isset($uri['scheme'])) {
-    $result->error = 'missing schema';
+  if ($uri == FALSE) {
+    $result->error = 'unable to parse URL';
     return $result;
   }
 
-  if (!isset($uri['host'])) {
-    $result->error = 'missing host';
+  if (!isset($uri['scheme'])) {
+    $result->error = 'missing schema';
     return $result;
   }
 
diff --git a/includes/tests/common.test b/modules/simpletest/tests/common.test
similarity index 82%
rename from includes/tests/common.test
rename to modules/simpletest/tests/common.test
index 2fed68527817875e250a8e6518a2cbd9a393b718..d9c6ceaa156a21a82b0bbd9684aca1dcb5201ff6 100644
--- a/includes/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -112,4 +112,28 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase {
       $this->_assert(FALSE, t('Leftover tag %leftover was left over.', array('%leftover' => $leftover)));
     }
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Test drupal_http_request().
+ */
+class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Drupal HTTP request'),
+      'description' => t("Performs tests on Drupal's HTTP request mechanism."),
+      'group' => t('System')
+    );
+  }
+
+  function testDrupalHTTPRequest() {
+    $missing_scheme = drupal_http_request('example.com/path');
+    $this->assertEqual($missing_scheme->error, 'missing schema', t('Returned with missing scheme error.'));
+
+    $unable_to_parse = drupal_http_request('http:///path');
+    $this->assertEqual($unable_to_parse->error, 'unable to parse URL', t('Returned with unable to parse URL error.'));
+  }
+}