|
|
|
@ -977,11 +977,14 @@ impl HTTP2State {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn process_headers(&mut self, blocks: &Vec<parser::HTTP2FrameHeaderBlock>, dir: Direction) {
|
|
|
|
fn process_headers(
|
|
|
|
|
|
|
|
&mut self, blocks: &Vec<parser::HTTP2FrameHeaderBlock>, dir: Direction,
|
|
|
|
|
|
|
|
) -> Vec<HTTP2Event> {
|
|
|
|
|
|
|
|
let mut events = Vec::new();
|
|
|
|
let (mut update, mut sizeup) = (false, 0);
|
|
|
|
let (mut update, mut sizeup) = (false, 0);
|
|
|
|
for block in blocks {
|
|
|
|
for block in blocks {
|
|
|
|
if block.error >= parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeError {
|
|
|
|
if block.error >= parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeError {
|
|
|
|
self.set_event(HTTP2Event::InvalidHeader);
|
|
|
|
events.push(HTTP2Event::InvalidHeader);
|
|
|
|
} else if block.error == parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeSizeUpdate {
|
|
|
|
} else if block.error == parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeSizeUpdate {
|
|
|
|
update = true;
|
|
|
|
update = true;
|
|
|
|
if block.sizeupdate > sizeup {
|
|
|
|
if block.sizeupdate > sizeup {
|
|
|
|
@ -990,7 +993,7 @@ impl HTTP2State {
|
|
|
|
} else if block.error
|
|
|
|
} else if block.error
|
|
|
|
== parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeIntegerOverflow
|
|
|
|
== parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeIntegerOverflow
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self.set_event(HTTP2Event::HeaderIntegerOverflow);
|
|
|
|
events.push(HTTP2Event::HeaderIntegerOverflow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if update {
|
|
|
|
if update {
|
|
|
|
@ -1002,6 +1005,7 @@ impl HTTP2State {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
dyn_headers.max_size = sizeup as usize;
|
|
|
|
dyn_headers.max_size = sizeup as usize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return events;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn parse_frame_data(
|
|
|
|
fn parse_frame_data(
|
|
|
|
@ -1176,7 +1180,7 @@ impl HTTP2State {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
match parser::http2_parse_frame_push_promise(input, hflags, dyn_headers) {
|
|
|
|
match parser::http2_parse_frame_push_promise(input, hflags, dyn_headers) {
|
|
|
|
Ok((_, hs)) => {
|
|
|
|
Ok((_, hs)) => {
|
|
|
|
self.process_headers(&hs.blocks, dir);
|
|
|
|
events.extend(self.process_headers(&hs.blocks, dir));
|
|
|
|
return (HTTP2FrameTypeData::PUSHPROMISE(hs), events);
|
|
|
|
return (HTTP2FrameTypeData::PUSHPROMISE(hs), events);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(Err::Incomplete(_)) => {
|
|
|
|
Err(Err::Incomplete(_)) => {
|
|
|
|
@ -1247,7 +1251,7 @@ impl HTTP2State {
|
|
|
|
buf.stream_id = 0;
|
|
|
|
buf.stream_id = 0;
|
|
|
|
buf.data.clear();
|
|
|
|
buf.data.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.process_headers(&hs.blocks, dir);
|
|
|
|
events.extend(self.process_headers(&hs.blocks, dir));
|
|
|
|
return (HTTP2FrameTypeData::CONTINUATION(hs), events);
|
|
|
|
return (HTTP2FrameTypeData::CONTINUATION(hs), events);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(Err::Incomplete(_)) => {
|
|
|
|
Err(Err::Incomplete(_)) => {
|
|
|
|
@ -1311,7 +1315,7 @@ impl HTTP2State {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
match parser::http2_parse_frame_headers(input, hflags, dyn_headers) {
|
|
|
|
match parser::http2_parse_frame_headers(input, hflags, dyn_headers) {
|
|
|
|
Ok((hrem, hs)) => {
|
|
|
|
Ok((hrem, hs)) => {
|
|
|
|
self.process_headers(&hs.blocks, dir);
|
|
|
|
events.extend(self.process_headers(&hs.blocks, dir));
|
|
|
|
if !hrem.is_empty() {
|
|
|
|
if !hrem.is_empty() {
|
|
|
|
SCLogDebug!("Remaining data for HTTP2 headers");
|
|
|
|
SCLogDebug!("Remaining data for HTTP2 headers");
|
|
|
|
events.push(HTTP2Event::ExtraHeaderData);
|
|
|
|
events.push(HTTP2Event::ExtraHeaderData);
|
|
|
|
|