HTTP: rework state machine (#1966)

The goal if to correlate the right request-response pair, exporting
metadata from only one transaction (for example, the right url & return
state pair)

As a nice side effect, the code should be much cleaner, but that is a
matter of taste.

Two differences respect to the previous code:
* as it happens in the CI, if in the flow there are only one response
(before) and one request (after), only the metadata of the response are
saved/exported
* for performance reasons, we don't call `ndpi_parse_packet_line_info()`
anymore for ALL packets triggering the HTTP dissector, but only for the
packets that we already know belong to an HTTP flow. This is the reason
for the changes in RTSP/SOAP/... code
This commit is contained in:
Ivan Nardi
2023-05-16 16:01:55 +02:00
committed by GitHub
parent 8c224b464f
commit 4e186f6bfb
19 changed files with 296 additions and 305 deletions
+5
View File
@@ -55,6 +55,11 @@ static void ndpi_search_rtsp_tcp_udp(struct ndpi_detection_module_struct *ndpi_s
LINE_ENDS(packet->content_line, "application/x-rtsp-tunnelled") != 0))
{
ndpi_int_rtsp_add_connection(ndpi_struct, flow);
/* Extract some metadata HTTP-like */
if(packet->user_agent_line.ptr != NULL)
ndpi_user_agent_set(flow, packet->user_agent_line.ptr, packet->user_agent_line.len);
return;
}