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

Upcase Authorization header to fix HTTP Basic Auth #804

Closed
wants to merge 1 commit into from

Conversation

nickarnold
Copy link

Some web servers are particularly sensitive to proper casing with the HTTP Authorization header. This PR fixes that problem by changing the header from authorization to Authorization. All tests were passing without modification.

@mikeal
Copy link
Member

mikeal commented Feb 7, 2014

hasHeader is caseless. we set the auth header lowercase on purpose because most node programms check and validate lowercase headers.

any server that doesn't support lowercase headers is in violation of the http spec. if you have to support one you can set the header yourself with the case you want and we won't clobber it but i'm not going to change the default because most people checking in node code will check against the lowercase one.

@mikeal mikeal closed this Feb 7, 2014
@nickarnold
Copy link
Author

@mikeal It appears that you are correct with regard to the header spec. The RFC that I read prior to issuing the PR was specific to HTTP authorization, and listed the auth header capitalized throughout. However, after reading your response I did some more research and found this document, which clearly states that headers are case-insensitive.

Thanks for making this lib, btw.

@mikeal
Copy link
Member

mikeal commented Feb 8, 2014

Thanks for using it and engage with the project :)

While the spec says that headers are caseless there are still servers (Hacker News among them) that routinely violate that part of the spec and have to be dealt with on a case-by-case basis.

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

Successfully merging this pull request may close these issues.

None yet

2 participants