Remove the port part of the hostname + according test suite

patch from prx
This commit is contained in:
Solene Rapenne 2021-01-01 16:08:51 +01:00
commit ef93e01091
2 changed files with 11 additions and 0 deletions

7
main.c
View file

@ -268,6 +268,13 @@ main(int argc, char **argv)
*/
estrlcpy(file, "/index.gmi", 11);
}
/* check if client added :port at end of request */
pos = strchr(request, ':');
if (pos != NULL) {
/* end string at :*/
pos[0] = '\0';
}
/* copy hostname from request */
estrlcpy(hostname, request, sizeof(hostname));
/*