diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-02-05 23:04:44 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-02-05 23:04:44 +0000 |
commit | f6e2bfd464a7ffd7ec24194da2a9a1e285387560 (patch) | |
tree | 25f0bcff222cb2da182f070076e45b972380e62e /lib/hostip.c | |
parent | 1ae5dab8fbf1df0d11a7d3aa93e0100c629178bc (diff) |
Jun-ichiro itojun Hagino's IPv6 adjustments
Diffstat (limited to 'lib/hostip.c')
-rw-r--r-- | lib/hostip.c | 23 |
1 files changed, 23 insertions, 0 deletions
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. */ |