python-oauth2
python-oauth2 copied to clipboard
uppercase 'Authorization' header
Integrated python-oauth2 with twisted framework. Twisted sets all headers names to lowercase while the oauth module expects uppercase 'Authorization'. Rather that a hack to revert the header before calling oauth routimes (from_request for example) any suggestions how to better handle this?
Hilarious that this hasn't been touched in a year, despite still being an issue.
Nginx normalizes all headers to the HTTP_*** format, meaning that by the time wsgi/django even has a chance to look at them, the original casing has been lost. This means, in order to prepare headers for oauth2, we need to strip the prefix, replace the underscores with hyphens, and then capitalize the first letter of every word.
This is very silly, seeing as http headers are defined by spec as being case-insensitive. It would be great if oauth2 didn't force users to coerce their data into a specific casing. All header checks should be case insensitive.