mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-16 18:19:47 +05:30
Merge pull request #188 from ushahidi/fix-http-headers-util-request
Fix Resource server Request HTTP header access
This commit is contained in:
commit
00d5fb5834
@ -165,7 +165,7 @@ class Resource
|
|||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if ($error === 'invalid_token') {
|
if ($error === 'invalid_token') {
|
||||||
$authScheme = null;
|
$authScheme = null;
|
||||||
$request = new Request();
|
$request = Request::buildFromGlobals();
|
||||||
if ($request->server('PHP_AUTH_USER') !== null) {
|
if ($request->server('PHP_AUTH_USER') !== null) {
|
||||||
$authScheme = 'Basic';
|
$authScheme = 'Basic';
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,15 +76,18 @@ class Request implements RequestInterface
|
|||||||
|
|
||||||
protected function readHeaders()
|
protected function readHeaders()
|
||||||
{
|
{
|
||||||
if (function_exists('getallheaders')) {
|
if (function_exists('apache_request_headers')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$headers = getallheaders();
|
$headers = apache_request_headers();
|
||||||
|
} elseif (function_exists('http_get_request_headers')) {
|
||||||
|
$headers = http_get_request_headers();
|
||||||
} else {
|
} else {
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
$headers = array();
|
$headers = array();
|
||||||
foreach ($this->server() as $name => $value) {
|
foreach ($this->server() as $name => $value) {
|
||||||
if (substr($name, 0, 5) == 'HTTP_') {
|
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;
|
$headers[$name] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user