Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.790
diff -u -p -r1.790 common.inc
--- includes/common.inc	6 Sep 2008 15:06:10 -0000	1.790
+++ includes/common.inc	8 Sep 2008 07:13:54 -0000
@@ -533,10 +533,10 @@ function drupal_http_request($url, $head
     if (isset($result->headers[$header]) && $header == '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[strtolower($header)] .= ',' . trim($value);
     }
     else {
-      $result->headers[$header] = trim($value);
+      $result->headers[strtolower($header)] = trim($value);
     }
   }
 
@@ -560,7 +560,7 @@ function drupal_http_request($url, $head
     case 301: // Moved permanently
     case 302: // Moved temporarily
     case 307: // Moved temporarily
-      $location = $result->headers['Location'];
+      $location = $result->headers['location'];
 
       if ($retry) {
         $result = drupal_http_request($location, $headers, $method, $data, --$retry);
Index: modules/aggregator/aggregator.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v
retrieving revision 1.391
diff -u -p -r1.391 aggregator.module
--- modules/aggregator/aggregator.module	6 Sep 2008 08:36:19 -0000	1.391
+++ modules/aggregator/aggregator.module	8 Sep 2008 07:13:56 -0000
@@ -613,7 +613,7 @@ function aggregator_refresh($feed) {
 
       // Filter the input data.
       if (aggregator_parse_feed($result->data, $feed)) {
-        $modified = empty($result->headers['Last-Modified']) ? 0 : strtotime($result->headers['Last-Modified']);
+        $modified = empty($result->headers['last-modified']) ? 0 : strtotime($result->headers['last-modified']);
 
         // Prepare the channel data.
         foreach ($channel as $key => $value) {
@@ -634,7 +634,7 @@ function aggregator_refresh($feed) {
           $image = NULL;
         }
 
-        $etag = empty($result->headers['ETag']) ? '' : $result->headers['ETag'];
+        $etag = empty($result->headers['etag']) ? '' : $result->headers['etag'];
         // Update the feed data.
         db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', hash = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], $_SERVER['REQUEST_TIME'], $channel['LINK'], $channel['DESCRIPTION'], $image, $md5, $etag, $modified, $feed['fid']);
 
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.28
diff -u -p -r1.28 openid.module
--- modules/openid/openid.module	6 Sep 2008 08:36:20 -0000	1.28
+++ modules/openid/openid.module	8 Sep 2008 07:13:57 -0000
@@ -275,14 +275,14 @@ function openid_discovery($claimed_id) {
     $result = drupal_http_request($xrds_url, $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
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.6
diff -u -p -r1.6 common.test
--- modules/simpletest/tests/common.test	6 Sep 2008 15:06:10 -0000	1.6
+++ modules/simpletest/tests/common.test	8 Sep 2008 07:13:57 -0000
@@ -193,6 +193,9 @@ class DrupalHTTPRequestTestCase extends 
 
     $redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array(), 'GET', NULL, 0);
     $this->assertFalse(isset($redirect_307->redirect_code), t('drupal_http_request does not follow 307 redirect if $retry = 0.'));
+
+    $redirect_307_lowercase = drupal_http_request(url('system-test/redirect-lowercase', array('absolute' => TRUE)), array(), 'GET', NULL, 1);
+    $this->assertEqual($redirect_307_lowercase->redirect_code, 307, t('drupal_http_request follows the redirect when the Location header is written lowercase.'));
   }
 
   function testDrupalGetDestination() {
Index: modules/simpletest/tests/system_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v
retrieving revision 1.1
diff -u -p -r1.1 system_test.module
--- modules/simpletest/tests/system_test.module	2 Sep 2008 17:00:34 -0000	1.1
+++ modules/simpletest/tests/system_test.module	8 Sep 2008 07:13:57 -0000
@@ -32,6 +32,11 @@ function system_test_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['system-test/redirect-lowercase'] = array(
+    'page callback' => 'system_test_redirect_lowercase',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
   $items['system-test/destination'] = array(
     'title' => 'Redirect',
     'page callback' => 'system_test_destination',
@@ -73,6 +78,11 @@ function system_test_redirect_invalid_sc
   exit;
 }
 
+function system_test_redirect_lowercase() {
+  header("location: http://localhost/foo", TRUE, 307);
+  exit;
+}
+
 function system_test_destination() {
   return 'The destination: ' . drupal_get_destination();
 }
