Merge branch 'develop' of github.com:thephpleague/oauth2-server into develop

This commit is contained in:
Alex Bilbie 2014-07-23 16:05:42 +01:00
commit 1890d71838
2 changed files with 9 additions and 6 deletions

View File

@ -165,7 +165,7 @@ class Resource
// @codeCoverageIgnoreStart
if ($error === 'invalid_token') {
$authScheme = null;
$request = new Request();
$request = Request::buildFromGlobals();
if ($request->server('PHP_AUTH_USER') !== null) {
$authScheme = 'Basic';
} else {

View File

@ -76,15 +76,18 @@ class Request implements RequestInterface
protected function readHeaders()
{
if (function_exists('getallheaders')) {
if (function_exists('apache_request_headers')) {
// @codeCoverageIgnoreStart
$headers = getallheaders();
$headers = apache_request_headers();
} elseif (function_exists('http_get_request_headers')) {
$headers = http_get_request_headers();
} else {
// @codeCoverageIgnoreEnd
$headers = array();
foreach ($this->server() as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
// HTTP_FOO_BAR becomes FOO-BAR
$name = str_replace(array('HTTP_', '_'), array('', '-'), $name);
$headers[$name] = $value;
}
}