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

Case sensitive header names #114

Open
archaelus opened this issue Jul 11, 2014 · 10 comments
Open

Case sensitive header names #114

archaelus opened this issue Jul 11, 2014 · 10 comments

Comments

@archaelus
Copy link

HTTP Header names are case insensitive, but Hackney returns a proplist of headers and the obvious way to extract a value proplists:get_value is case sensitive.

I would suggest either normalizing the case of the proplist keys before returning them, or return a hackney_headers data structure, which would encourage users to call hackney_headers:get_value(CaseInsensitiveKey, Headers, Default).

Doing this will ensure user code doesn't break if/when an HTTP intermediary changes the case of response headers (ala Amazon ELBs, Heroku's HTTP router, etc).

@benoitc
Copy link
Owner

benoitc commented Sep 22, 2014

hrm good idea, I will take care about it in next version.

@ypaq
Copy link

ypaq commented Dec 22, 2014

+1

3 similar comments
@tnt-dev
Copy link
Contributor

tnt-dev commented Dec 25, 2014

+1

@jurriaan
Copy link

jurriaan commented Mar 8, 2015

+1

@tjsousa
Copy link

tjsousa commented Nov 22, 2015

+1

@tjsousa
Copy link

tjsousa commented Nov 22, 2015

I ran into an issue when using HTTPoison, a popular Elixir client that uses Hackney, and headers from a Plug connection, which are lower-cased by default.

More info here: slogsdon/elixir-reverse-proxy#2

@benoitc
Copy link
Owner

benoitc commented Nov 23, 2015

i will handle that i the next release. for now you can do hackney_headers:new(Headers) to use the module hackney_headers and get and an header case insensitively.

@suprafly
Copy link

Still seeing this issue.

@benoitc
Copy link
Owner

benoitc commented May 19, 2017

@suprafly next major release may have it though why not using the hackney_headers module?

@suprafly
Copy link

@benoitc Thanks. I found a work around, I messed around with using the hackney_headers module, however my problem with is that I am using hackney via the HTTPoison library in Elixir. It was not obvious how I could pass headers generated with that module down into hackney.

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

No branches or pull requests

7 participants