summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc15
-rw-r--r--modules/aggregator/aggregator.parser.inc4
-rw-r--r--modules/openid/openid.module6
-rw-r--r--modules/simpletest/tests/system_test.module3
4 files changed, 16 insertions, 12 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 0f93e34da..a1169d174 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -758,7 +758,9 @@ function drupal_access_denied() {
* - 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. HTTP
+ * header names are case-insensitive (RFC 2616, section 4.2), so for easy
+ * access the array keys are returned in lower case.
* - data
* A string containing the response body that was received.
*/
@@ -917,14 +919,15 @@ function drupal_http_request($url, array $options = 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);
}
}
@@ -984,7 +987,7 @@ function drupal_http_request($url, array $options = array()) {
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;
diff --git a/modules/aggregator/aggregator.parser.inc b/modules/aggregator/aggregator.parser.inc
index 9757da1fe..5eb84db42 100644
--- a/modules/aggregator/aggregator.parser.inc
+++ b/modules/aggregator/aggregator.parser.inc
@@ -24,7 +24,7 @@ function aggregator_aggregator_parse($feed) {
// 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) {
@@ -43,7 +43,7 @@ function aggregator_aggregator_parse($feed) {
$image = '';
}
- $etag = empty($feed->http_headers['ETag']) ? '' : $feed->http_headers['ETag'];
+ $etag = empty($feed->http_headers['etag']) ? '' : $feed->http_headers['etag'];
// Add parsed data to the feed object.
$feed->link = !empty($channel['LINK']) ? $channel['LINK'] : '';
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index ff4cd719c..d5c868969 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -437,14 +437,14 @@ function _openid_xrds_discovery($claimed_id) {
$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 = _openid_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
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module
index 1f1e535c6..5fa2fdc85 100644
--- a/modules/simpletest/tests/system_test.module
+++ b/modules/simpletest/tests/system_test.module
@@ -110,7 +110,8 @@ function system_test_basic_auth_page() {
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 '';