From f6e2bfd464a7ffd7ec24194da2a9a1e285387560 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 5 Feb 2001 23:04:44 +0000 Subject: Jun-ichiro itojun Hagino's IPv6 adjustments --- lib/hostip.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/hostip.c') diff --git a/lib/hostip.c b/lib/hostip.c index cb7bc19a5..c1f3fde11 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -83,6 +83,29 @@ static char *MakeIP(unsigned long num,char *addr, int addr_len) return (addr); } +#ifdef ENABLE_IPV6 +struct addrinfo *Curl_getaddrinfo(struct UrlData *data, + char *hostname, + int port) +{ + struct addrinfo hints, *res; + int error; + char sbuf[NI_MAXSERV]; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + snprintf(sbuf, sizeof(sbuf), "%d", port); + error = getaddrinfo(hostname, sbuf, &hints, &res); + if (error) { + infof(data, "getaddrinfo(3) failed for %s\n", hostname); + return NULL; + } + return res; +} +#endif + /* The original code to this function was once stolen from the Dancer source code, written by Bjorn Reese, it has since been patched and modified considerably. */ -- cgit v1.2.3