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:
@@ -1116,11 +1116,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
|
||||
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.request_content_type, sizeof(flow->http.request_content_type), "%s", flow->ndpi_flow->http.request_content_type ? flow->ndpi_flow->http.request_content_type : "");
|
||||
ndpi_snprintf(flow->http.user_agent, sizeof(flow->http.user_agent), "%s", flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : "");
|
||||
}
|
||||
} else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SSDP) ||
|
||||
is_ndpi_proto(flow, NDPI_PROTOCOL_XIAOMI)) {
|
||||
ndpi_snprintf(flow->http.user_agent, sizeof(flow->http.user_agent), "%s", flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : "");
|
||||
} else if(is_ndpi_proto(flow, NDPI_PROTOCOL_TELNET)) {
|
||||
if(flow->ndpi_flow->protos.telnet.username[0] != '\0')
|
||||
flow->telnet.username = ndpi_strdup(flow->ndpi_flow->protos.telnet.username);
|
||||
@@ -1145,8 +1141,6 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
|
||||
) {
|
||||
flow->ssh_tls.ssl_version = flow->ndpi_flow->protos.tls_quic.ssl_version;
|
||||
|
||||
ndpi_snprintf(flow->http.user_agent, sizeof(flow->http.user_agent), "%s", flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : "");
|
||||
|
||||
if(flow->ndpi_flow->protos.tls_quic.server_names_len > 0 && flow->ndpi_flow->protos.tls_quic.server_names)
|
||||
flow->ssh_tls.server_names = ndpi_strdup(flow->ndpi_flow->protos.tls_quic.server_names);
|
||||
|
||||
@@ -1224,6 +1218,10 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
|
||||
}
|
||||
}
|
||||
|
||||
ndpi_snprintf(flow->http.user_agent,
|
||||
sizeof(flow->http.user_agent),
|
||||
"%s", (flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : ""));
|
||||
|
||||
if(flow->detection_completed && (!flow->check_extra_packets)) {
|
||||
if(is_ndpi_proto(flow, NDPI_PROTOCOL_UNKNOWN)) {
|
||||
if(workflow->__flow_giveup_callback != NULL)
|
||||
|
||||
Reference in New Issue
Block a user