}
ScanResult HttpBodyH2Cutter::cut(const uint8_t* buffer, uint32_t length,
- HttpInfractions* infractions, HttpEventGen* events, uint32_t flow_target, bool /*stretch*/,
+ HttpInfractions* infractions, HttpEventGen* events, uint32_t flow_target, bool stretch,
H2BodyState state)
{
- // FIXIT-E accelerated blocking not yet supported for HTTP/2
- // FIXIT-E stretch not yet supported for HTTP/2 message bodies
-
// If the headers included a content length header (expected length >= 0), check it against the
// actual message body length. Alert if it does not match at the end of the message body or if
// it overflows during the body (alert once then stop computing).
}
else
{
- num_flush = flow_target - octets_seen;
+ if (stretch && (octets_seen + length <= flow_target + MAX_SECTION_STRETCH))
+ num_flush = length;
+ else
+ num_flush = flow_target - octets_seen;
total_octets_scanned += num_flush;
need_accelerated_blocking(buffer, num_flush);
return SCAN_FOUND_PIECE;
}
else if (state == H2_BODY_LAST_SEG)
{
- if (octets_seen + length <= flow_target)
+ const uint32_t adjusted_target = stretch ? MAX_SECTION_STRETCH + flow_target : flow_target;
+ if (octets_seen + length <= adjusted_target)
num_flush = length;
else
num_flush = flow_target - octets_seen;
void HttpMsgBodyH2::update_flow()
{
session_data->body_octets[source_id] = body_octets;
- if (session_data->h2_body_state[source_id] == H2_BODY_NOT_COMPLETE)
+ if (session_data->h2_body_state[source_id] == H2_BODY_NOT_COMPLETE ||
+ session_data->h2_body_state[source_id] == H2_BODY_LAST_SEG)
update_depth();
else if (session_data->h2_body_state[source_id] == H2_BODY_COMPLETE_EXPECT_TRAILERS)
session_data->trailer_prep(source_id);