diff --git a/includes/common.inc b/includes/common.inc
index 8849ef8..b677d58 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -869,9 +869,9 @@ function drupal_http_request($url, array $options = array()) {
   // user-agent is used to ensure that multiple testing sessions running at the
   // same time won't interfere with each other as they would if the database
   // prefix were stored statically in a file or database variable.
-  $test_info = &$GLOBALS['drupal_test_info'];
-  if (!empty($test_info['test_run_id'])) {
-    $options['headers']['User-Agent'] = drupal_generate_test_ua($test_info['test_run_id']);
+  $in_test_site = !empty($GLOBALS['drupal_test_info']['test_run_id']);
+  if ($in_test_site) {
+    $options['headers']['User-Agent'] = drupal_generate_test_ua($GLOBALS['drupal_test_info']['test_run_id']);
   }
 
   $request = $options['method'] . ' ' . $path . " HTTP/1.0\r\n";
@@ -936,6 +936,17 @@ function drupal_http_request($url, array $options = array()) {
       // Cookie:, followed by a comma-separated list of one or more cookies.
       $result->headers[$name] .= ',' . trim($value);
     }
+    elseif ($in_test_site && strstr($name, 'x-drupal-assertion-')) {
+      $assertion = unserialize(urldecode(trim($value)));
+      $message = strtr('%type: !message in %function (line %line of %file).', array(
+        '%type' => $assertion[1],
+        '!message' => $assertion[0],
+        '%function' => $assertion[2]['function'],
+        '%line' => $assertion[2]['line'],
+        '%file' => $assertion[2]['file'],
+      ));
+      trigger_error($message, $assertion['error_level']);
+    }
     else {
       $result->headers[$name] = trim($value);
     }
diff --git a/includes/errors.inc b/includes/errors.inc
index bd31beb..63c060e 100644
--- a/includes/errors.inc
+++ b/includes/errors.inc
@@ -85,6 +85,7 @@ function _drupal_error_handler_real($error_level, $message, $filename, $line, $c
       '%file' => $caller['file'],
       '%line' => $caller['line'],
       'severity_level' => $severity_level,
+      'error_level' => $error_level,
     ), $error_level == E_RECOVERABLE_ERROR);
   }
 }
@@ -206,6 +207,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
         'file' => $error['%file'],
         'line' => $error['%line'],
       ),
+      'error_level' => $error['error_level'],
     );
     header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion)));
     $number++;
