diff --git a/includes/common.inc b/includes/common.inc
index 8849ef8..68fceb3 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, E_USER_ERROR);
+    }
     else {
       $result->headers[$name] = trim($value);
     }
