Skip to content

Commit

Permalink
fix(headers): kill raw part when getting mutable reference to typed h…
Browse files Browse the repository at this point in the history
…eader

If you get a mutable reference to a typed header it is possible to make
the two representations be out of sync. To avoid this, after parsing the
raw part it should be removed.

Fixes hyperium#821.
  • Loading branch information
andresilva committed Jun 17, 2016
1 parent 43ac0dd commit 084072c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/header/internals/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl Item {
if self.typed.get_mut(tid).is_none() {
match parse::<H>(self.raw.as_ref().expect("item.raw must exist")) {
Ok(typed) => {
self.raw = OptCell::new(None);
unsafe { self.typed.insert(tid, typed); }
},
Err(_) => ()
Expand Down

0 comments on commit 084072c

Please sign in to comment.