-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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::Request: store common header names in a normalized way #8061
HTTP::Request: store common header names in a normalized way #8061
Conversation
5033080
to
3e9f396
Compare
3e9f396
to
3755dc4
Compare
From HTTP/2 and onwards the normalized form of HTTP headers is... downcased. And HTTP/2 is much more common that it would seem. We should embrace the future (that started yesterday) and just store headers lowercased, we're only going to receive them more and more downcased, even in HTTP/1. |
3755dc4
to
1b0fcfb
Compare
Updated! I think we could later use a binary search to optimize this but doing it with slices proved to be a bit hard for me when I tried to timebox it. |
1b0fcfb
to
f0c6cd6
Compare
Done with binary search :-) (I think I got it right) |
f0c6cd6
to
ce97f87
Compare
Ho, @ysbaddaden is right. For example in GitHub response headers are all downcased:
But my request headers are in camelcase with dashes. |
@j8r Yes, this is likely the way we're going to move forward. But it's not the point here. We don't want to introduce a breaking change at this point. On the contrary, this PR is supposed to be a bugfix in 0.30.1 for the behaviour that was unintentionally broken in 0.30.0. The idea to normalize all headers downcased should be discussed in a separate issue and has a broader scope than just |
Fixes #8060
Doesn't actually fix it because we aren't storing exactly what was sent, but since headers are case insensitive this shouldn't be a problem. I think the "normalized" way is pretty common and used everywhere so in most cases this way will match what was sent.
If this is a real problem, though, we can revert this optimization.