Treat 127.0.0.1, [::1], and hostname as localhost

This commit is contained in:
Tatsuya Kinoshita
2021-04-23 20:16:50 +09:00
parent 552dff061b
commit 59ea885da0
6 changed files with 38 additions and 38 deletions

10
etc.c
View File

@@ -1573,6 +1573,16 @@ expandName(char *name)
}
#endif
int
is_localhost(const char *host)
{
if (!host ||
!strcasecmp(host, "localhost") || !strcmp(host, "127.0.0.1") ||
(HostName && !strcasecmp(host, HostName)) || !strcmp(host, "[::1]"))
return TRUE;
return FALSE;
}
char *
file_to_url(char *file)
{