Improve normalization of flow->host_server_name (#2310)
Follow-up of 4543385d10
Remove trailing spaces for any HTTP header (we already remove leading
spaces)
We want:
* a "normalized" string in `flow->host_server_name`, but
* to parse the original string for flow risk checking
`ndpi_hostname_sni_set()` is a private function, so there is no need to
export its flags.
This commit is contained in:
@@ -8698,6 +8698,13 @@ static void parse_single_packet_line(struct ndpi_detection_module_struct *ndpi_s
|
||||
if(h->line->len == 0)
|
||||
h->line->ptr = NULL;
|
||||
|
||||
/* Stripping trailing spaces */
|
||||
while(h->line->len > 0 && h->line->ptr[h->line->len - 1] == ' ') {
|
||||
h->line->len--;
|
||||
}
|
||||
if(h->line->len == 0)
|
||||
h->line->ptr = NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user