Skip to content

Conversation

@tuupola
Copy link
Contributor

@tuupola tuupola commented May 9, 2016

When sending something else than valid Authorization: Basic header PHP will not set the HTTP_AUTHORIZATION environment. Because of this the Authorization header is not available via $request->getHeader("Authorization"). See #1784, #1616.

This is problematic when you are using Authorization: Bearer or something similar. Usual workaround is to add the following rewrite rule.

RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

However even without the workaround, the header is however available via getallheaders(). This PR adds a fallback call to getallheaders() when it is available and HTTP_AUTHORIZATION is not set.

Tries to get Authorization header from getallheaders() if it is available
and HTTP_AUTHORIZATION does not already exist.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 88.05% when pulling 3dc2c14 on tuupola:getallheaders-fallback into 954472c on slimphp:3.x.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 88.05% when pulling 76b6598 on tuupola:getallheaders-fallback into 954472c on slimphp:3.x.

*
* @return Environment
*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a more specific method name.

@akrabat akrabat self-assigned this May 19, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+7.8%) to 95.823% when pulling dc3cb63 on tuupola:getallheaders-fallback into 954472c on slimphp:3.x.

@akrabat akrabat merged commit dc3cb63 into slimphp:3.x May 19, 2016
akrabat added a commit that referenced this pull request May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants