Index: drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.2.2.3.2.19
diff -u -p -r1.2.2.3.2.19 drupal_web_test_case.php
--- drupal_web_test_case.php	22 Oct 2008 23:16:46 -0000	1.2.2.3.2.19
+++ drupal_web_test_case.php	5 Nov 2008 20:35:51 -0000
@@ -6,6 +6,7 @@
  */
 class DrupalWebTestCase {
   protected $_logged_in = FALSE;
+  protected $_headers;
   protected $_content;
   protected $plain_text;
   protected $ch;
@@ -772,6 +773,18 @@ class DrupalWebTestCase {
   }
 
   /**
+   * Saves HTTP response headers to the _headers array.
+   */
+  private function _readHeaders($ch, $header) {
+    $length = strlen($header);
+    $header = trim($header);
+    if ($header !== '') {
+      $this->_headers[] = $header;
+    }
+    return $length;
+  }
+
+  /**
    * Initializes the cURL connection and gets a session cookie.
    *
    * This function will add authentication headers as specified in
@@ -788,7 +801,8 @@ class DrupalWebTestCase {
         CURLOPT_FOLLOWLOCATION => TRUE,
         CURLOPT_RETURNTRANSFER => TRUE,
         CURLOPT_SSL_VERIFYPEER => FALSE,
-		CURLOPT_SSL_VERIFYHOST => FALSE,
+        CURLOPT_SSL_VERIFYHOST => FALSE,
+        CURLOPT_HEADERFUNCTION => array($this, '_readHeaders'),
       );
       if (preg_match('/simpletest\d+/', $db_prefix)) {
         $curl_options[CURLOPT_USERAGENT] = $db_prefix;
@@ -815,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->_content = curl_exec($this->ch);
     $this->plain_text = FALSE;
     $this->elements = FALSE;
@@ -1289,6 +1304,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() {
