DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
Flow *f, HtpState *htp_state,
- uint8_t flags,
+ const uint8_t flags,
uint32_t *buffer_len,
uint32_t *stream_start_offset)
{
goto end;
}
- if (!htp_state->cfg->http_body_inline) {
+ if (!htp_state->cfg->http_body_inline && !(flags & STREAM_FLUSH)) {
/* inspect the body if the transfer is complete or we have hit
* our body size limit */
if ((htp_state->cfg->request.body_limit == 0 ||
offset);
det_ctx->hcbd[index].offset = offset;
- /* move inspected tracker to end of the data. HtpBodyPrune will consider
- * the window sizes when freeing data */
- htud->request_body.body_inspected = htud->request_body.content_len_so_far;
-
+ if (htud->request_body.content_len_so_far < htp_state->cfg->request.inspect_min_size) {
+ SCLogDebug("not updating tracker as we're still below inspect_min_size");
+ } else {
+ /* move inspected tracker to end of the data. HtpBodyPrune will consider
+ * the window sizes when freeing data */
+ htud->request_body.body_inspected = htud->request_body.content_len_so_far;
+ }
buffer = det_ctx->hcbd[index].buffer;
*buffer_len = det_ctx->hcbd[index].buffer_len;
*stream_start_offset = det_ctx->hcbd[index].offset;
flags & STREAM_EOF ? "true" : "false",
(AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, flags) > HTP_RESPONSE_BODY) ? "true" : "false");
- if (!htp_state->cfg->http_body_inline) {
+ if (!htp_state->cfg->http_body_inline && !(flags & STREAM_FLUSH)) {
/* inspect the body if the transfer is complete or we have hit
* our body size limit */
if ((htp_state->cfg->response.body_limit == 0 ||
offset);
det_ctx->hsbd[index].offset = offset;
- /* move inspected tracker to end of the data. HtpBodyPrune will consider
- * the window sizes when freeing data */
- htud->response_body.body_inspected = htud->response_body.content_len_so_far;
- SCLogDebug("htud->response_body.body_inspected now: %"PRIu64, htud->response_body.body_inspected);
-
+ if (htud->response_body.content_len_so_far < htp_state->cfg->response.inspect_min_size) {
+ SCLogDebug("not updating tracker as we're still below inspect_min_size");
+ } else {
+ /* move inspected tracker to end of the data. HtpBodyPrune will consider
+ * the window sizes when freeing data */
+ htud->response_body.body_inspected = htud->response_body.content_len_so_far;
+ SCLogDebug("htud->response_body.body_inspected now: %"PRIu64, htud->response_body.body_inspected);
+ }
buffer = det_ctx->hsbd[index].buffer;
*buffer_len = det_ctx->hsbd[index].buffer_len;
*stream_start_offset = det_ctx->hsbd[index].offset;
if (p->proto == IPPROTO_TCP && pflow->protoctx &&
StreamReassembleRawHasDataReady(pflow->protoctx, p)) {
p->flags |= PKT_DETECT_HAS_STREAMDATA;
+ flow_flags |= STREAM_FLUSH;
}
SCLogDebug("alstate %s, alproto %u", has_state ? "true" : "false", alproto);
} else {
#define STREAM_TOCLIENT 0x08
#define STREAM_GAP 0x10 /**< data gap encountered */
#define STREAM_DEPTH 0x20 /**< depth reached */
+#define STREAM_FLUSH 0x80
typedef int (*StreamSegmentCallback)(const Packet *, void *, const uint8_t *, uint32_t);
int StreamSegmentForEach(const Packet *p, uint8_t flag,