aboutsummaryrefslogtreecommitdiffstats
path: root/etc.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-04-23 11:16:50 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-04-23 11:16:50 +0000
commit59ea885da07c0916fb5917efb5538df2ecec1553 (patch)
tree7788717c19054ae6300f222374c1179e00bf9c8d /etc.c
parentUpdate ChangeLog (diff)
downloadw3m-59ea885da07c0916fb5917efb5538df2ecec1553.tar.gz
w3m-59ea885da07c0916fb5917efb5538df2ecec1553.zip
Treat 127.0.0.1, [::1], and hostname as localhost
Diffstat (limited to 'etc.c')
-rw-r--r--etc.c10
1 files changed, 10 insertions, 0 deletions
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)
{