diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2020-07-07 14:43:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 14:43:32 +0200 |
commit | db707e0829d29f7aed6d2a5848706600ca8ff971 (patch) | |
tree | 18028e1c8eba670d61304ae13a49835bc48ce139 /src/lib/protocols/http.c | |
parent | 540326f3ffcc3126a1db3811464046ac7e061157 (diff) | |
parent | 030f3f3d48184133a6647108c156787fb3f39b58 (diff) |
Merge pull request #932 from IvanNardi/log
Log
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r-- | src/lib/protocols/http.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 9ac26785c..8f74d22ad 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -558,6 +558,14 @@ static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, /* ************************************************************* */ +#ifdef NDPI_ENABLE_DEBUG_MESSAGES +static uint8_t non_ctrl(uint8_t c) { + return c < 32 ? '.':c; +} +#endif + +/* ************************************************************* */ + /** * Functions to check whether the packet begins with a valid http request * @param ndpi_struct @@ -589,8 +597,10 @@ static u_int16_t http_request_url_offset(struct ndpi_detection_module_struct *nd int i; NDPI_LOG_DBG2(ndpi_struct, "====>>>> HTTP: %c%c%c%c [len: %u]\n", - non_ctrl(packet->payload[0]), non_ctrl(packet->payload[1]), - non_ctrl(packet->payload[2]), non_ctrl(packet->payload[3]), + packet->payload_packet_len > 0 ? non_ctrl(packet->payload[0]) : '.', + packet->payload_packet_len > 1 ? non_ctrl(packet->payload[1]) : '.', + packet->payload_packet_len > 2 ? non_ctrl(packet->payload[2]) : '.', + packet->payload_packet_len > 3 ? non_ctrl(packet->payload[3]) : '.', packet->payload_packet_len); /* Check first char */ |