aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/http.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2021-02-03 11:53:41 +0100
committerGitHub <noreply@github.com>2021-02-03 11:53:41 +0100
commit8cee718e8b3a64ac9b66f88844f43f0594c1bb37 (patch)
tree98b98ad285785025c82a7755829b53ef91a35ecd /src/lib/protocols/http.c
parent155b1aaa687f1757cea92071fc053b28a49fab21 (diff)
HTTP: fix logs when NDPI_ENABLE_DEBUG_MESSAGES is defined (#1123)
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r--src/lib/protocols/http.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 15d9b2948..eec2a7bf1 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -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");
}
}