Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.55
diff -u -p -r1.55 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	5 Nov 2008 17:06:18 -0000	1.55
+++ modules/simpletest/drupal_web_test_case.php	6 Nov 2008 16:26:53 -0000
@@ -6,6 +6,7 @@
  */
 class DrupalWebTestCase {
   protected $_logged_in = FALSE;
+  protected $_headers;
   protected $_content;
   protected $_url;
   protected $plain_text;
@@ -828,6 +829,7 @@ class DrupalWebTestCase {
     $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->_headers = array();
     $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->drupalGetContent();
@@ -849,6 +851,10 @@ class DrupalWebTestCase {
       // Call DrupalWebTestCase::error() with the parameters from the header.
       call_user_func_array(array(&$this, 'error'), unserialize(urldecode($matches[1])));
     }
+    // Save header to the _headers array.
+    if (trim($header) !== '') {
+      $this->_headers[] = $header;
+    }
     // This is required by cURL.
     return strlen($header);
   }
@@ -1321,6 +1327,13 @@ class DrupalWebTestCase {
   }
 
   /**
+   * Gets the current HTTP headers of the requested page.
+   */
+  function drupalGetHeaders() {
+    return $this->_headers;
+  }
+
+  /**
    * Gets the current raw HTML of requested page.
    */
   function drupalGetContent() {
