Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.938
diff -u -8 -p -r1.938 common.inc
--- includes/common.inc	22 Jul 2009 04:45:35 -0000	1.938
+++ includes/common.inc	22 Jul 2009 19:23:06 -0000
@@ -445,17 +445,18 @@ function drupal_access_denied() {
  *       The status message from the response, if a response was received.
  *   - redirect_code
  *       If redirected, an integer containing the initial response status code.
  *   - redirect_url
  *       If redirected, a string containing the redirection location.
  *   - error
  *       If an error occurred, the error message. Otherwise not set.
  *   - headers
- *       An array containing the response headers as name/value pairs.
+ *       An array containing the response headers as name/value pairs. The keys
+ *       are lower case.
  *   - data
  *       A string containing the response body that was received.
  */
 function drupal_http_request($url, array $options = array()) {
   global $db_prefix;
 
   $result = new stdClass();
 
@@ -588,24 +589,25 @@ function drupal_http_request($url, array
   list($protocol, $code, $status_message) = explode(' ', trim(array_shift($response)), 3);
   $result->protocol = $protocol;
   $result->status_message = $status_message;
 
   $result->headers = array();
 
   // Parse the response headers.
   while ($line = trim(array_shift($response))) {
-    list($header, $value) = explode(':', $line, 2);
-    if (isset($result->headers[$header]) && $header == 'Set-Cookie') {
+    list($name, $value) = explode(':', $line, 2);
+    $name = strtolower($name);
+    if (isset($result->headers[$name]) && $name == 'set-cookie') {
       // RFC 2109: the Set-Cookie response header comprises the token Set-
       // Cookie:, followed by a comma-separated list of one or more cookies.
-      $result->headers[$header] .= ',' . trim($value);
+      $result->headers[$name] .= ',' . trim($value);
     }
     else {
-      $result->headers[$header] = trim($value);
+      $result->headers[$name] = trim($value);
     }
   }
 
   $responses = array(
     100 => 'Continue',
     101 => 'Switching Protocols',
     200 => 'OK',
     201 => 'Created',
@@ -655,17 +657,17 @@ function drupal_http_request($url, array
 
   switch ($code) {
     case 200: // OK
     case 304: // Not modified
       break;
     case 301: // Moved permanently
     case 302: // Moved temporarily
     case 307: // Moved temporarily
-      $location = $result->headers['Location'];
+      $location = $result->headers['location'];
       $options['timeout'] -= timer_read(__FUNCTION__) / 1000;
       if ($options['timeout'] <= 0) {
         $result->code = HTTP_REQUEST_TIMEOUT;
         $result->error = 'request timed out';
       }
       elseif ($options['max_redirects']) {
         // Redirect to the new location.
         $options['max_redirects']--;
Index: modules/aggregator/aggregator.parser.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.parser.inc,v
retrieving revision 1.4
diff -u -8 -p -r1.4 aggregator.parser.inc
--- modules/aggregator/aggregator.parser.inc	15 Jul 2009 21:32:43 -0000	1.4
+++ modules/aggregator/aggregator.parser.inc	22 Jul 2009 19:23:06 -0000
@@ -19,17 +19,17 @@ function aggregator_aggregator_parse_inf
 /**
  * Implement hook_aggregator_parse().
  */
 function aggregator_aggregator_parse($feed) {
   global $channel, $image;
 
   // Filter the input data.
   if (aggregator_parse_feed($feed->source_string, $feed)) {
-    $modified = empty($feed->http_headers['Last-Modified']) ? 0 : strtotime($feed->http_headers['Last-Modified']);
+    $modified = empty($feed->http_headers['last-modified']) ? 0 : strtotime($feed->http_headers['last-modified']);
 
     // Prepare the channel data.
     foreach ($channel as $key => $value) {
       $channel[$key] = trim($value);
     }
 
     // Prepare the image data (if any).
     foreach ($image as $key => $value) {
@@ -38,17 +38,17 @@ function aggregator_aggregator_parse($fe
 
     if (!empty($image['link']) && !empty($image['url']) && !empty($image['title'])) {
       $image = l(theme('image', $image['url'], $image['title']), $image['link'], array('html' => TRUE));
     }
     else {
       $image = '';
     }
 
-    $etag = empty($feed->http_headers['ETag']) ? '' : $feed->http_headers['ETag'];
+    $etag = empty($feed->http_headers['etag']) ? '' : $feed->http_headers['etTag'];
     // Update the feed data.
     db_merge('aggregator_feed')
       ->key(array('fid' => $feed->fid))
       ->fields(array(
         'url' => $feed->url,
         'checked' => REQUEST_TIME,
         'link' => !empty($channel['link']) ? $channel['link'] : '',
         'description' => !empty($channel['description']) ? $channel['description'] : '',
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.51
diff -u -8 -p -r1.51 openid.module
--- modules/openid/openid.module	30 Jun 2009 11:32:08 -0000	1.51
+++ modules/openid/openid.module	22 Jul 2009 19:23:06 -0000
@@ -283,24 +283,24 @@ function openid_discovery($claimed_id) {
   }
   $scheme = @parse_url($xrds_url, PHP_URL_SCHEME);
   if ($scheme == 'http' || $scheme == 'https') {
     // For regular URLs, try Yadis resolution first, then HTML-based discovery
     $headers = array('Accept' => 'application/xrds+xml');
     $result = drupal_http_request($xrds_url, array('headers' => $headers));
 
     if (!isset($result->error)) {
-      if (isset($result->headers['Content-Type']) && preg_match("/application\/xrds\+xml/", $result->headers['Content-Type'])) {
+      if (isset($result->headers['content-type']) && preg_match("/application\/xrds\+xml/", $result->headers['content-type'])) {
         // Parse XML document to find URL
         $services = xrds_parse($result->data);
       }
       else {
         $xrds_url = NULL;
-        if (isset($result->headers['X-XRDS-Location'])) {
-          $xrds_url = $result->headers['X-XRDS-Location'];
+        if (isset($result->headers['x-xrds-Location'])) {
+          $xrds_url = $result->headers['x-xrds-Location'];
         }
         else {
           // Look for meta http-equiv link in HTML head
           $xrds_url = _openid_meta_httpequiv('X-XRDS-Location', $result->data);
         }
         if (!empty($xrds_url)) {
           $headers = array('Accept' => 'application/xrds+xml');
           $xrds_result = drupal_http_request($xrds_url, array('headers' => $headers));
Index: modules/simpletest/tests/system_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v
retrieving revision 1.12
diff -u -8 -p -r1.12 system_test.module
--- modules/simpletest/tests/system_test.module	6 Jun 2009 15:43:05 -0000	1.12
+++ modules/simpletest/tests/system_test.module	22 Jul 2009 19:23:07 -0000
@@ -70,17 +70,18 @@ function system_test_basic_auth_page() {
   $output = t('$_SERVER[\'PHP_AUTH_USER\'] is @username.', array('@username' => $_SERVER['PHP_AUTH_USER']));
   $output .= t('$_SERVER[\'PHP_AUTH_PW\'] is @password.', array('@password' => $_SERVER['PHP_AUTH_PW']));
   return $output;
 }
 
 function system_test_redirect($code) {
   $code = (int)$code;
   if ($code != 200) {
-    header("Location: " . url('system-test/redirect/200', array('absolute' => TRUE)), TRUE, $code);
+    // Header names are case-insensitive.
+    header("locaTION: " . url('system-test/redirect/200', array('absolute' => TRUE)), TRUE, $code);
     exit;
   }
   return '';
 }
 
 function system_test_set_header() {
   drupal_set_header($_GET['name'], $_GET['value']);
   return t('The following header was set: %name: %value', array('%name' => $_GET['name'], '%value' => $_GET['value']));
