HTTP: fix logs when NDPI_ENABLE_DEBUG_MESSAGES is defined (#1123)

This commit is contained in:
Ivan Nardi
2021-02-03 11:53:41 +01:00
committed by GitHub
parent 155b1aaa68
commit 8cee718e8b
+4 -10
View File
@@ -111,12 +111,10 @@ static void ndpi_http_check_human_redeable_content(struct ndpi_detection_module_
struct ndpi_flow_struct *flow,
const u_int8_t *content, u_int16_t content_len) {
if(content_len >= 4) {
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
printf(" [len: %u] [%02X %02X %02X %02X][%c%c%c%c]", content_len,
NDPI_LOG_DBG(ndpi_struct, " [len: %u] [%02X %02X %02X %02X][%c%c%c%c]", content_len,
content[0], content[1], content[2], content[3],
content[0], content[1], content[2], content[3]
);
#endif
if(ndpi_http_is_print(content[0]) && ndpi_http_is_print(content[1])
&& ndpi_http_is_print(content[2]) && ndpi_http_is_print(content[3])) {
@@ -142,10 +140,8 @@ static void ndpi_validate_http_content(struct ndpi_detection_module_struct *ndpi
struct ndpi_packet_struct *packet = &flow->packet;
const u_int8_t *double_ret = (const u_int8_t *)ndpi_strnstr((const char *)packet->payload, "\r\n\r\n", packet->payload_packet_len);
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
printf("==>>> [len: %u] ", packet->payload_packet_len);
printf("->> %.*s\n", packet->content_line.len, (const char *)packet->content_line.ptr);
#endif
NDPI_LOG_DBG(ndpi_struct, "==>>> [len: %u] ", packet->payload_packet_len);
NDPI_LOG_DBG(ndpi_struct, "->> %.*s\n", packet->content_line.len, (const char *)packet->content_line.ptr);
if(double_ret) {
u_int len;
@@ -167,9 +163,7 @@ static void ndpi_validate_http_content(struct ndpi_detection_module_struct *ndpi
}
}
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
printf("\n");
#endif
NDPI_LOG_DBG(ndpi_struct, "\n");
}
}