Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rust/src/http2/decompression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
}

Expand Down
8 changes: 6 additions & 2 deletions rust/src/http2/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ impl HTTP2State {
let over = head.flags & parser::HTTP2_FLAG_HEADER_EOS != 0;
let ftype = head.ftype;
let sid = head.stream_id;
let padded = head.flags & parser::HTTP2_FLAG_HEADER_PADDED != 0;
if dir == Direction::ToServer {
tx.frames_ts.push(HTTP2Frame {
header: head,
Expand All @@ -956,9 +957,12 @@ impl HTTP2State {
} else {
tx_same.ft_ts.tx_id = tx_same.tx_id - 1;
};

let mut dinput = &rem[..hlsafe];
if padded && rem.len() > 0 && usize::from(rem[0]) < hlsafe{
dinput = &rem[1..hlsafe - usize::from(rem[0])];
}
match tx_same.decompress(
&rem[..hlsafe],
dinput,
dir,
sfcm,
over,
Expand Down
2 changes: 1 addition & 1 deletion rust/src/http2/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ pub struct HTTP2FrameHeaders {
//end stream
pub const HTTP2_FLAG_HEADER_EOS: u8 = 0x1;
pub const HTTP2_FLAG_HEADER_END_HEADERS: u8 = 0x4;
const HTTP2_FLAG_HEADER_PADDED: u8 = 0x8;
pub const HTTP2_FLAG_HEADER_PADDED: u8 = 0x8;
const HTTP2_FLAG_HEADER_PRIORITY: u8 = 0x20;

fn http2_parse_headers_blocks<'a>(
Expand Down