Removed http:// from HTTP url

Reported URL in ndpiReader
This commit is contained in:
Luca Deri
2019-10-01 12:25:39 +02:00
parent a62cf10233
commit e45237a93f
4 changed files with 20 additions and 5 deletions
+3 -4
View File
@@ -162,13 +162,12 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
if((flow->http.url == NULL)
&& (packet->http_url_name.len > 0)
&& (packet->host_line.len > 0)) {
int len = packet->http_url_name.len + packet->host_line.len + 7 + 1; /* "http://" */
int len = packet->http_url_name.len + packet->host_line.len + 1;
flow->http.url = ndpi_malloc(len);
if(flow->http.url) {
strcpy(flow->http.url, "http://");
strncpy(&flow->http.url[7], (char*)packet->host_line.ptr, packet->host_line.len);
strncpy(&flow->http.url[7+packet->host_line.len], (char*)packet->http_url_name.ptr,
strncpy(flow->http.url, (char*)packet->host_line.ptr, packet->host_line.len);
strncpy(&flow->http.url[packet->host_line.len], (char*)packet->http_url_name.ptr,
packet->http_url_name.len);
flow->http.url[len-1] = '\0';
}