Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP "authorization" header not accepted (case-sensitive) #34

Closed
cweiske opened this issue Sep 7, 2016 · 7 comments
Closed

HTTP "authorization" header not accepted (case-sensitive) #34

cweiske opened this issue Sep 7, 2016 · 7 comments

Comments

@cweiske
Copy link
Contributor

cweiske commented Sep 7, 2016

HTTP headers are meant to be processed case-insensitive, but the code only accepts Authorization (word case) and not authorization (lowercase).

HTTP 1.1 RFC 2616 section 4.2 says:

Field names are case-insensitive.

@cweiske
Copy link
Contributor Author

cweiske commented Sep 7, 2016

@snarfed: Should I adjust getallheaders() or lowercase its result in authorize()?

@voxpelli
Copy link
Member

voxpelli commented Sep 7, 2016

The getallheaders() seems to already run a strtolower()? https://github.com/snarfed/wordpress-micropub/blob/f91bd8c88a1e2ad0399745537ab7aa442d04a3aa/micropub.php#L555

@snarfed
Copy link
Member

snarfed commented Sep 7, 2016

true! the bug is probably just that the 'Authorization's here should be 'authorization's.

@voxpelli
Copy link
Member

voxpelli commented Sep 7, 2016

No, because it also does a ucwords(), but maybe a function name collision? Not the most unique of function names that one

7 sep. 2016 kl. 18:07 skrev Ryan Barrett notifications@github.com:

true! the bug is probably just that 'Authorization' here should be 'authorization'.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@cweiske
Copy link
Contributor Author

cweiske commented Sep 7, 2016

here in my local installation, the micropub-provided getallheaders is not used. So while the mp-provided getallheaders Word-Cases the header names (thus Authorization would work), the one that's actually used does not.

@cweiske
Copy link
Contributor Author

cweiske commented Sep 7, 2016

Ah. PHP itself defines it. http://php.net/getallheaders

@cweiske
Copy link
Contributor Author

cweiske commented Sep 7, 2016

So lowercasing the result of this function is the correct way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants