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

fix: avoid panic when translating from hyperium #359

Merged

Conversation

Fishrock123
Copy link
Member

The opposite direction also uses hyperium's append, but (I think) this was written before that same functionality existed in http-types.

This is somewhat important for my use and I intend to make a 2.11.1 release with this.

@Fishrock123 Fishrock123 requested a review from jbr April 27, 2021 00:43
Copy link
Member

@jbr jbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. It overwrote previously?

@Fishrock123
Copy link
Member Author

Err, actually, it theoretically overwrote previously but it actually just unconditionally panic-ed on any new header, since we're unwrapping the option from https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.insert ...

I'll update the commit message to clarify that this really did not work before.

@Fishrock123 Fishrock123 force-pushed the fix-hyperium_http-headers-multiple branch from 172d856 to c713ca4 Compare April 27, 2021 17:25
@Fishrock123 Fishrock123 changed the title fix: append from hyperium rather than insert fix: append from hyperium translation Apr 27, 2021
Before it always paniced on new headers while trying to blankly unwrap
the return of a hashmap insert.

This makes it:
  a. no longer unwrap at all, which was incorrect, and
  b. use append for duplicates

The opposite direction also uses hyperium's append, but (I think) this
was written before that same functionality existed in http-types.
@Fishrock123 Fishrock123 force-pushed the fix-hyperium_http-headers-multiple branch from c713ca4 to a222b1d Compare April 27, 2021 17:26
@Fishrock123 Fishrock123 merged commit 52cc143 into http-rs:main Apr 27, 2021
@Fishrock123 Fishrock123 deleted the fix-hyperium_http-headers-multiple branch April 27, 2021 17:35
@Fishrock123 Fishrock123 changed the title fix: append from hyperium translation fix: avoid panic when translating from hyperium Apr 27, 2021
@Fishrock123 Fishrock123 mentioned this pull request Apr 27, 2021
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

Successfully merging this pull request may close these issues.

2 participants