mirror of
https://github.com/curl/curl.git
synced 2026-08-24 21:43:32 +03:00
Jun-ichiro itojun Hagino's IPv6 adjustments
This commit is contained in:
parent
1ae5dab8fb
commit
f6e2bfd464
8 changed files with 369 additions and 16 deletions
23
lib/hostip.c
23
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. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue