Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.768
diff -u -r1.768 common.inc
--- includes/common.inc	16 May 2008 01:23:31 -0000	1.768
+++ includes/common.inc	20 May 2008 20:03:35 -0000
@@ -414,6 +414,7 @@
  *   data and redirect status.
  */
 function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
+  global $db_prefix, $simpletest_ua_key;
   static $self_test = FALSE;
   $result = new stdClass();
   // Try to clear the drupal_http_request_fails variable if it's set. We
@@ -482,6 +483,11 @@
     $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
   }
 
+  // Apply SimpleTest user-agent if tests are running.
+  if (preg_match("/^simpletest\d+/", $db_prefix)) {
+    $headers['User-Agent'] = "$db_prefix,$simpletest_ua_key";
+  }
+
   foreach ($headers as $header => $value) {
     $defaults[$header] = $header . ': ' . $value;
   }
