From 9d02b1a8fb1b87861a2909c99b165ad63b9a4616 Mon Sep 17 00:00:00 2001 From: aiooss-anssi Date: Fri, 12 Jul 2024 19:06:46 +0200 Subject: [PATCH] webapp: fix http replay requests --- webapp/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/main.py b/webapp/main.py index 10a34e2..4ee8616 100644 --- a/webapp/main.py +++ b/webapp/main.py @@ -215,14 +215,14 @@ async def api_replay_http(request): # For each HTTP request, load client payload if it exists data = [] - for row in rows: + for tx_id, row in enumerate(rows): req = row_to_dict(row) req["rq_content"] = None if req["http_method"] in ["POST"]: - # Get associated fileinfo + # First result should be the request cursor = await eve_database.execute( - "SELECT extra_data FROM fileinfo WHERE flow_id = ? ORDER BY id", - [flow_id], + "SELECT extra_data FROM fileinfo WHERE flow_id = ? AND extra_data->>'tx_id' = ? ORDER BY id", + [flow_id, tx_id], ) fileinfo_first_event = await cursor.fetchone() if not fileinfo_first_event: