Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.811
diff -u -p -r1.811 common.inc
--- includes/common.inc	26 Oct 2008 18:06:38 -0000	1.811
+++ includes/common.inc	27 Oct 2008 14:29:49 -0000
@@ -535,10 +535,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);
     }
   }
 
@@ -562,7 +562,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.396
diff -u -p -r1.396 aggregator.module
--- modules/aggregator/aggregator.module	20 Oct 2008 12:57:35 -0000	1.396
+++ modules/aggregator/aggregator.module	27 Oct 2008 14:29:51 -0000
@@ -682,7 +682,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) {
@@ -703,7 +703,7 @@ function aggregator_refresh($feed) {
           $image = '';
         }
 
-        $etag = empty($result->headers['ETag']) ? '' : $result->headers['ETag'];
+        $etag = empty($result->headers['etag']) ? '' : $result->headers['etag'];
         // Update the feed data.
         db_merge('aggregator_feed')
           ->key(array('fid' => $feed['fid']))
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.32
diff -u -p -r1.32 openid.module
--- modules/openid/openid.module	26 Oct 2008 18:06:38 -0000	1.32
+++ modules/openid/openid.module	27 Oct 2008 14:29:52 -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.10
diff -u -p -r1.10 common.test
--- modules/simpletest/tests/common.test	26 Oct 2008 18:06:39 -0000	1.10
+++ modules/simpletest/tests/common.test	27 Oct 2008 14:29:52 -0000
@@ -243,6 +243,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.4
diff -u -p -r1.4 system_test.module
--- modules/simpletest/tests/system_test.module	15 Oct 2008 16:05:51 -0000	1.4
+++ modules/simpletest/tests/system_test.module	27 Oct 2008 14:29:53 -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',
@@ -102,6 +107,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();
 }
