diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ndpi_main.c | 2 | ||||
-rw-r--r-- | src/lib/protocols/http.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index dca58a29a..6061d6419 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -5277,7 +5277,7 @@ void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_str, const struct ndpi_tcphdr *tcph = packet->tcp; const struct ndpi_udphdr *udph = packet->udp; - if(packet->payload_packet_len > 0) { + if(ndpi_str->max_payload_track_len > 0 && packet->payload_packet_len > 0) { /* printf("LEN: %u [%s]\n", packet->payload_packet_len, packet->payload); */ if(flow->flow_payload == NULL) diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 9e6def210..80c4c8041 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -659,7 +659,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ flow->http.url = ndpi_malloc(len); if(flow->http.url) { - u_int offset = 0; + u_int offset = 0, host_end = 0; if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP_CONNECT) { strncpy(flow->http.url, (char*)packet->http_url_name.ptr, @@ -668,8 +668,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ flow->http.url[packet->http_url_name.len] = '\0'; } else { /* Check if we pass through a proxy (usually there is also the Via: ... header) */ - if(strncmp((char*)packet->http_url_name.ptr, "http://", 7) != 0) + if(strncmp((char*)packet->http_url_name.ptr, "http://", 7) != 0) { strncpy(flow->http.url, (char*)packet->host_line.ptr, offset = packet->host_line.len); + host_end = packet->host_line.len; + } if((packet->host_line.len == packet->http_url_name.len) && (strncmp((char*)packet->host_line.ptr, @@ -684,7 +686,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ flow->http.url[offset] = '\0'; } - ndpi_check_http_url(ndpi_struct, flow, &flow->http.url[packet->host_line.len]); + ndpi_check_http_url(ndpi_struct, flow, &flow->http.url[host_end]); } flow->http.method = ndpi_http_str2method((const char*)packet->http_method.ptr, |