From 669b7579ff93eb22ccf9324fd19444754b5612b8 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sun, 31 May 2020 19:31:01 +0200 Subject: HTTP comparison optimization --- src/lib/protocols/http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 7db270212..9f2a59fc4 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -105,7 +105,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo const char *app = (const char *)&packet->content_line.ptr[app_len]; u_int app_len_avail = packet->content_line.len-app_len; - if(ndpi_strncasestr(app, "mpeg", app_len_avail) != NULL) { + if(strncasecmp(app, "mpeg", app_len_avail) == 0) { flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_STREAMING; return(flow->category); } else if(app_len_avail > 3) { @@ -121,7 +121,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo u_int8_t i; for(i = 0; cmp_mimes[i] != NULL; i++) { - if(ndpi_strncasestr(app, cmp_mimes[i], app_len_avail) != NULL) { + if(strncasecmp(app, cmp_mimes[i], app_len_avail) == 0) { flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; NDPI_SET_BIT(flow->risk, NDPI_BINARY_APPLICATION_TRANSFER); NDPI_LOG_INFO(ndpi_struct, "found executable HTTP transfer"); -- cgit v1.2.3