# bugfix (#1484523) fixed rc_request_header function

* normalized input ($HEADER)
    * also normalized the arrays
    * returning "really" NULL now (without issueing a warning!)
release-0.6
till 17 years ago
parent ed7dd90083
commit 0144c50fc4

@ -525,22 +525,29 @@ function rc_strrpos($haystack, $needle, $offset=0)
/** /**
* Read a specific HTTP request header * Read a specific HTTP request header
* *
* @param string Header name * @access static
* @return string Header value or null if not available * @param string $name Header name
* @return mixed Header value or null if not available
*/ */
function rc_request_header($name) function rc_request_header($name)
{
if (function_exists('getallheaders'))
{ {
if (function_exists('getallheaders'))
{
$hdrs = getallheaders(); $hdrs = getallheaders();
return $hdrs[$name]; $hdrs = array_change_key_case($hdrs, CASE_UPPER);
} $key = strtoupper($name);
}
else else
{ {
$key = "HTTP_" . strtoupper(strtr($name, "-", "_")); $key = 'HTTP_' . strtoupper(strtr($name, '-', '_'));
return $_SERVER[$key]; $hdrs = array_change_key_case($_SERVER[$key], CASE_UPPER);
}
if (isset($hdrs[$key]))
{
return $hdrs[$key];
}
return null;
} }
}
/** /**

Loading…
Cancel
Save