Index: drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/drupal_web_test_case.php,v
retrieving revision 1.2.2.3.2.47
diff -u -p -r1.2.2.3.2.47 drupal_web_test_case.php
--- drupal_web_test_case.php	27 Jan 2010 01:55:29 -0000	1.2.2.3.2.47
+++ drupal_web_test_case.php	30 Jul 2010 13:03:00 -0000
@@ -1383,7 +1383,15 @@ class DrupalWebTestCase extends DrupalTe
    *   An header.
    */
   protected function curlHeaderCallback($curlHandler, $header) {
-    $this->headers[] = $header;
+    // Headers starts with HTTP version and ends with empty line. They could be
+    // splited on chunks so they should be joined while been receiced. Details
+    // in rfc2616 http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
+    if (strpos($header, 'HTTP/') !== 0 && strpos($header, ':') === FALSE && trim($header) != '') {
+      $this->headers[] = array_pop($this->headers) . $header;
+    }
+    else {
+      $this->headers[] = $header;
+    }
 
     // Errors are being sent via X-Drupal-Assertion-* headers,
     // generated by _drupal_log_error() in the exact form required
