From e0afc16aa2ae78c39b7b51c73840f79ba1723c9c Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Mon, 5 Dec 2022 21:27:30 +0100 Subject: Exported HTTP server in metadata --- src/lib/protocols/http.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/protocols/http.c') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index e33ee265d..2c8f474fa 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -882,6 +882,17 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ flow->guessed_category = flow->category = ndpi_http_check_content(ndpi_struct, flow); } } + + if((flow->http.server == NULL) && (packet->server_line.len > 0)) { + int len = packet->server_line.len + 1; + + flow->http.server = ndpi_malloc(len); + if(flow->http.server) { + strncpy(flow->http.server, (char*)packet->server_line.ptr, + packet->server_line.len); + flow->http.server[packet->server_line.len] = '\0'; + } + } } if(flow->http_detected && packet->content_line.ptr && *(char*)packet->content_line.ptr) { -- cgit v1.2.3