From fd2b524dfb8842a575980d9280862eb6b82e1d7c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 6 Jul 2021 19:59:56 +0200 Subject: Improved RTSP detection the second. (#1232) * RTSP is no subprotocol of HTTP (most of the time) * detection patterns should stay in rtsp.c * set detected HTTP protocol only if at least a valid HTTP method detected Signed-off-by: Toni Uhlig --- src/lib/protocols/http.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib/protocols/http.c') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 36da51078..6a3df8e26 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -499,8 +499,6 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ struct ndpi_packet_struct *packet = &flow->packet; int ret; - ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP, NDPI_PROTOCOL_UNKNOWN); - if(flow->http_detected && (flow->http.response_status_code != 0)) return; @@ -667,7 +665,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ } } - ndpi_int_http_add_connection(ndpi_struct, flow, packet->detected_protocol_stack[0], NDPI_PROTOCOL_CATEGORY_WEB); + if (ndpi_get_http_method(ndpi_struct, flow) != NDPI_HTTP_METHOD_UNKNOWN) + { + ndpi_int_http_add_connection(ndpi_struct, flow, packet->detected_protocol_stack[0], NDPI_PROTOCOL_CATEGORY_WEB); + } } /* ************************************************************* */ -- cgit v1.2.3