From c6349d3cfcab47224b49293688ca18242ccbdb21 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 21 Nov 2022 16:21:19 +0100 Subject: [PATCH] http2: support padded data frames Ticket: #5691 --- rust/src/http2/http2.rs | 8 ++++++-- rust/src/http2/parser.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index 404081c94c..3a6ffab7ec 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -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, @@ -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, diff --git a/rust/src/http2/parser.rs b/rust/src/http2/parser.rs index 90b7ba6394..6c16d8762f 100644 --- a/rust/src/http2/parser.rs +++ b/rust/src/http2/parser.rs @@ -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>(