From 59ea885da07c0916fb5917efb5538df2ecec1553 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Fri, 23 Apr 2021 20:16:50 +0900 Subject: Treat 127.0.0.1, [::1], and hostname as localhost --- etc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'etc.c') diff --git a/etc.c b/etc.c index 7cdd220..aeb65ec 100644 --- a/etc.c +++ b/etc.c @@ -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) { -- cgit v1.2.3