http2: fix decompression buffering

It was not enough to set Cursor position to 0,
also its inner Vec should be cleared.

This way, a new input gets written at the beginning of the
Cursor and its inner Vec...

Ticket: #5691
pull/8198/head
Philippe Antoine 2 years ago committed by Victor Julien
parent c6349d3cfc
commit 086b28da3d

@ -50,6 +50,11 @@ impl HTTP2cursor {
pub fn set_position(&mut self, pos: u64) {
return self.cursor.set_position(pos);
}
pub fn clear(&mut self) {
self.cursor.get_mut().clear();
self.cursor.set_position(0);
}
}
// we need to implement this as flate2 and brotli crates
@ -156,8 +161,7 @@ fn http2_decompress<'a>(
}
}
//brotli does not consume all input if it reaches some end
decoder.get_mut().set_position(0);
decoder.get_mut().clear();
return Ok(&output[..offset]);
}

Loading…
Cancel
Save