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

Response headers are not capitalized in 0.12 #1539

Open
resilar opened this issue Jun 5, 2018 · 6 comments
Open

Response headers are not capitalized in 0.12 #1539

resilar opened this issue Jun 5, 2018 · 6 comments
Labels
A-server Area: server. C-feature Category: feature. This is adding a new feature. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful.

Comments

@resilar
Copy link

resilar commented Jun 5, 2018

I'm running Hyper server and I noticed that capitalization of response headers was lost somewhere between the versions 0.11.27 and 0.12.1. Is this intentional? New behavior:

capitalization.png

@pimeys
Copy link

pimeys commented Jun 5, 2018

At least the RFC notes that the headers are case-insensitive:

https://tools.ietf.org/html/rfc2616#page-31

Ja huumeet.info, tori jne :D

@seanmonstar
Copy link
Member

Yes, this is expected. The HeaderName from the http crate keeps things lowercase for performance and compatibility with HTTP2.

HTTP/1 clients and servers should work just fine with any case, since RFC7230 declares them as case-insensitive. There are the occasional clients or servers that erroneously require title case headers. There was a config option added for the client to use title case, and if there's need, we can also add a server option.

@logaritmisk
Copy link

I'm dealing with a "hard to please" client, and title case headers is one of the things I have to use. So this is a feature I would love to see.

@seanmonstar
Copy link
Member

Adding the option to the server is... kind of "easy", in that it can make use of the title case function used by the client encoding. The only tricky part I see is that the Server::encode function is highly optimized, so checking a boolean in a loop may be unfortunate. I wonder if there's something clever that can be done to avoid that.

@seanmonstar seanmonstar added A-server Area: server. C-feature Category: feature. This is adding a new feature. labels Jun 11, 2018
@ps1dr3x
Copy link

ps1dr3x commented Aug 1, 2018

I'm having this problem too. I'm writing a proxy and this is causing the proxied request be different from the original request. Maybe i can make some tests and try to work on a pull request?

@rolftimmermans
Copy link

I also would like this feature. I looked at the code but it seems header encoding for the server is not quite the same as for the client.

Can someone point me in the right direction of how this could be tackled? Then I can try to submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. C-feature Category: feature. This is adding a new feature. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful.
Projects
None yet
Development

No branches or pull requests

6 participants