diff options
Diffstat (limited to 'usr.sbin/httpd/httpd.c')
-rw-r--r-- | usr.sbin/httpd/httpd.c | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index ae0fa879ef5..af04f5c1a5b 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.68 2018/09/09 21:06:51 bluhm Exp $ */ +/* $OpenBSD: httpd.c,v 1.69 2020/07/30 21:06:19 benno Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -552,59 +552,6 @@ expand_string(char *label, size_t len, const char *srch, const char *repl) } const char * -canonicalize_host(const char *host, char *name, size_t len) -{ - struct sockaddr_in sin4; - struct sockaddr_in6 sin6; - size_t i, j; - size_t plen; - char c; - - if (len < 2) - goto fail; - - /* - * Canonicalize an IPv4/6 address - */ - if (inet_pton(AF_INET, host, &sin4) == 1) - return (inet_ntop(AF_INET, &sin4, name, len)); - if (inet_pton(AF_INET6, host, &sin6) == 1) - return (inet_ntop(AF_INET6, &sin6, name, len)); - - /* - * Canonicalize a hostname - */ - - /* 1. remove repeated dots and convert upper case to lower case */ - plen = strlen(host); - memset(name, 0, len); - for (i = j = 0; i < plen; i++) { - if (j >= (len - 1)) - goto fail; - c = tolower((unsigned char)host[i]); - if ((c == '.') && (j == 0 || name[j - 1] == '.')) - continue; - name[j++] = c; - } - - /* 2. remove trailing dots */ - for (i = j; i > 0; i--) { - if (name[i - 1] != '.') - break; - name[i - 1] = '\0'; - j--; - } - if (j <= 0) - goto fail; - - return (name); - - fail: - errno = EINVAL; - return (NULL); -} - -const char * url_decode(char *url) { char *p, *q; |