Work around Apache handling the Authorization: header differently

This commit is contained in:
Sebastien Barre 2016-08-07 19:50:23 -04:00
parent 0a22058e35
commit acc32f5c58

View file

@ -397,7 +397,7 @@ class CakeRequest implements ArrayAccess {
/**
* Get the content type used in this request.
*
*
* @return string
*/
public function contentType() {
@ -748,7 +748,12 @@ class CakeRequest implements ArrayAccess {
* @return mixed Either false on no header being set or the value of the header.
*/
public static function header($name) {
$name = 'HTTP_' . strtoupper(str_replace('-', '_', $name));
$http_name = 'HTTP_' . strtoupper(str_replace('-', '_', $name));
if (isset($_SERVER[$http_name])) {
return $_SERVER[$http_name];
}
// Work around Apache issue handling the "Authorization" header
// differently than other headers.
if (isset($_SERVER[$name])) {
return $_SERVER[$name];
}