aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/asyn-thread.c14
-rw-r--r--lib/curl_setup.h2
-rw-r--r--lib/hostip4.c10
3 files changed, 23 insertions, 3 deletions
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 8c552baa9..b08497aaa 100755
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -698,6 +698,16 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
*waitp = 0; /* default to synchronous response */
+#ifdef ENABLE_IPV6
+ {
+ struct in6_addr in6;
+ /* check if this is an IPv6 address string */
+ if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
+ /* This is an IPv6 address literal */
+ return Curl_ip2addr(AF_INET6, &in6, hostname, port);
+ }
+#endif /* ENABLE_IPV6 */
+
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
@@ -741,7 +751,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
}
-#ifdef CURLRES_IPV6
+#ifdef ENABLE_IPV6
{
struct in6_addr in6;
/* check if this is an IPv6 address string */
@@ -749,7 +759,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
/* This is an IPv6 address literal */
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
}
-#endif /* CURLRES_IPV6 */
+#endif /* ENABLE_IPV6 */
#endif /* !USE_RESOLVE_ON_IPS */
#ifdef CURLRES_IPV6
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index cc36e28ec..5d6e8d6f7 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -585,7 +585,7 @@
# define CURLRES_SYNCH
#endif
-#ifdef ENABLE_IPV6
+#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
# define CURLRES_IPV6
#else
# define CURLRES_IPV4
diff --git a/lib/hostip4.c b/lib/hostip4.c
index e6ba710d8..750e0dd5a 100644
--- a/lib/hostip4.c
+++ b/lib/hostip4.c
@@ -131,6 +131,16 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
struct in_addr in;
struct hostent *buf = NULL;
+#ifdef ENABLE_IPV6
+ {
+ struct in6_addr in6;
+ /* check if this is an IPv6 address string */
+ if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
+ /* This is an IPv6 address literal */
+ return Curl_ip2addr(AF_INET6, &in6, hostname, port);
+ }
+#endif /* ENABLE_IPV6 */
+
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);