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 --- example/ndpiReader.c | 3 +++ example/reader_util.c | 1 + example/reader_util.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'example') diff --git a/example/ndpiReader.c b/example/ndpiReader.c index e82e089db..326197ee3 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1578,6 +1578,9 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa fprintf(out, "[Content-Type: %s]", flow->http.content_type); } + if(flow->http.server[0] != '\0') + fprintf(out, "[Server: %s]", flow->http.server); + if(flow->http.user_agent[0] != '\0') fprintf(out, "[User-Agent: %s]", flow->http.user_agent); diff --git a/example/reader_util.c b/example/reader_util.c index 8c43f24ef..f3d7f73ff 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1214,6 +1214,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl ndpi_snprintf(flow->http.url, sizeof(flow->http.url), "%s", flow->ndpi_flow->http.url); flow->http.response_status_code = flow->ndpi_flow->http.response_status_code; ndpi_snprintf(flow->http.content_type, sizeof(flow->http.content_type), "%s", flow->ndpi_flow->http.content_type ? flow->ndpi_flow->http.content_type : ""); + ndpi_snprintf(flow->http.server, sizeof(flow->http.server), "%s", flow->ndpi_flow->http.server ? flow->ndpi_flow->http.server : ""); ndpi_snprintf(flow->http.request_content_type, sizeof(flow->http.request_content_type), "%s", flow->ndpi_flow->http.request_content_type ? flow->ndpi_flow->http.request_content_type : ""); } } diff --git a/example/reader_util.h b/example/reader_util.h index ce296e2d2..675b00bdf 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -275,7 +275,7 @@ typedef struct ndpi_flow_info { } ssh_tls; struct { - char url[256], request_content_type[64], content_type[64], user_agent[256]; + char url[256], request_content_type[64], content_type[64], user_agent[256], server[128]; u_int response_status_code; } http; -- cgit v1.2.3