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:
Ivan Nardi
2024-02-09 09:20:02 +01:00
committed by GitHub
parent 2abb68c8ca
commit f352e4f77b
7 changed files with 18 additions and 12 deletions
+7
View File
@@ -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;
}
}