diff --git a/includes/common.inc b/includes/common.inc
index 8d8b951c7c06dfefa3035f0dc2a7ce7a130e6a17..aebb8a1992ef28e7999b9f9f11c7406420b5e306 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -434,7 +434,7 @@ 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);
+  $uri = @parse_url($url);
 
   if ($uri == FALSE) {
     $result->error = 'unable to parse URL';
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 2c30163695f3552c311af8449c6373bfcb05d7bc..e5445af2952b00457d45c29a8cfa270daab7ff67 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -7,6 +7,7 @@
 class DrupalWebTestCase {
   protected $_logged_in = FALSE;
   protected $_content;
+  protected $_url;
   protected $plain_text;
   protected $ch;
   protected $elements;
@@ -756,11 +757,9 @@ protected function curlExec($curl_options) {
     $this->curlConnect();
     $url = empty($curl_options[CURLOPT_URL]) ? curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL) : $curl_options[CURLOPT_URL];
     curl_setopt_array($this->ch, $this->curl_options + $curl_options);
-    $this->_content = curl_exec($this->ch);
-    $this->plain_text = FALSE;
-    $this->elements = FALSE;
+    $this->drupalSetContent(curl_exec($this->ch), curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL));
     $this->assertTrue($this->_content !== FALSE, t('!method to !url, response is !length bytes.', array('!method' => !empty($curl_options[CURLOPT_NOBODY]) ? 'HEAD' : (empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST'), '!url' => $url, '!length' => strlen($this->_content))), t('Browser'));
-    return $this->_content;
+    return $this->drupalGetContent();
   }
 
   /**
@@ -1124,7 +1123,7 @@ function getAbsoluteUrl($path) {
    *   The current url.
    */
   function getUrl() {
-    return curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL);
+    return $this->_url;
   }
 
   /**
@@ -1134,6 +1133,22 @@ function drupalGetContent() {
     return $this->_content;
   }
 
+  /**
+   * Sets the raw HTML content. This can be useful when a page has been fetched
+   * outside of the internal browser and assertions need to be made on the
+   * returned page.
+   *
+   * A good example would be when testing drupal_http_request(). After fetching
+   * the page the content can be set and page elements can be checked to ensure
+   * that the function worked properly.
+   */
+  function drupalSetContent($content, $url = 'internal:') {
+    $this->_content = $content;
+    $this->_url = $url;
+    $this->plain_text = FALSE;
+    $this->elements = FALSE;
+  }
+
   /**
    * Pass if the raw text IS found on the loaded page, fail otherwise. Raw text
    * refers to the raw HTML that the page generated.
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index d9c6ceaa156a21a82b0bbd9684aca1dcb5201ff6..dc76829e5cda021159203c2514a8a25a680240ba 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -130,10 +130,17 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
   }
 
   function testDrupalHTTPRequest() {
+    // Parse URL schema.
     $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.'));
+
+    // Fetch page.
+    $result = drupal_http_request(url('node', array('absolute' => TRUE)));
+    $this->assertEqual($result->code, 200, t('Fetched page successfully.'));
+    $this->drupalSetContent($result->data);
+    $this->assertTitle(variable_get('site_name', 'Drupal'), t('Site title matches.'));
   }
 }