Added generic user agent setter. (#1530)

* ndpiReader: Print user agent if one was set and not just for certain protocols.

Signed-off-by: lns <matzeton@googlemail.com>
This commit is contained in:
Toni
2022-04-25 13:00:50 +02:00
committed by GitHub
parent 075bce5f3d
commit bc2ad3407a
12 changed files with 97 additions and 87 deletions
+3 -4
View File
@@ -52,10 +52,9 @@ static void xiaomi_dissect_metadata(struct ndpi_detection_module_struct *ndpi_st
switch(op) {
case 0x12:
flow->http.user_agent = ndpi_malloc(len + 1);
if(flow->http.user_agent != NULL) {
memcpy(flow->http.user_agent, &payload[offset], len);
flow->http.user_agent[len] = '\0';
if (ndpi_user_agent_set(flow, &payload[offset], len) == NULL)
{
NDPI_LOG_DBG2(ndpi_struct, "Could not set Xiaomi user agent\n");
}
break;