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

Body parsing broken in 0.3.0 #285

Closed
atymic opened this issue Jan 7, 2020 · 2 comments
Closed

Body parsing broken in 0.3.0 #285

atymic opened this issue Jan 7, 2020 · 2 comments

Comments

@atymic
Copy link
Contributor

atymic commented Jan 7, 2020

I've inherited a project using this library, and upon updating from 0.2 to 0.3 json responses aren't being parsed as they were previously in 0.2. I'll do a bit of investigating to try figure out why, but for the moment i've pinned it back to 0.2.

@atymic
Copy link
Contributor Author

atymic commented Jan 7, 2020

Ok, so I figured out the issue. The library parses the incoming headers straight from curl, and adds them to the array in whatever casing the appear as.

In 0.2.x, the behavior was lowercase all of the incoming headers, and then lowercase the requested header name before trying to grab it out of the array. This means that whatever the casing in the response, the header can always be found.

In 0.3.x, this behaviour was changed to no longer modify the header casing when parsing the response, and also removing the lowercasing when accessing headers. This means that unless the header is cased exactly the same as requested, it cannot be accessed. This is wrong according to the HTTP spec (and other HTTP implementations).

In HTTP2, all headers are lowercase, meaning that mime parsing will never work in the package.

I'm going to PR a failing test and then a fix when I get a chance :)

@atymic atymic changed the title Json parsing broken in 0.3.0 Body parsing broken in 0.3.0 Jan 7, 2020
@nategood
Copy link
Owner

Resolved

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

No branches or pull requests

2 participants