summaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorRadek Zajic <radek.zajic@showmax.com>2021-05-24 16:38:40 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-05-25 12:45:56 +0200
commit31f631a142d855f069242f3e0c643beec25d1b51 (patch)
treeaef4a898796ddf11f4d48dc80c445465c3784e66 /lib/hostip.c
parenta63dae5d078b24dc441e421a37fa7daf09fc4768 (diff)
downloadcurl-31f631a142d855f069242f3e0c643beec25d1b51.tar.gz
lib/hostip6.c: make NAT64 address synthesis on macOS work
Closes #7121
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 45190a100..055c190d1 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -68,6 +68,10 @@
#include "curl_memory.h"
#include "memdebug.h"
+#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
+#include <SystemConfiguration/SystemConfiguration.h>
+#endif
+
#if defined(CURLRES_SYNCH) && \
defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)
/* alarm-based timeouts can only be used with all the dependencies satisfied */
@@ -529,6 +533,19 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
return CURLRESOLV_ERROR;
}
+#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
+ /*
+ * The automagic conversion from IPv4 literals to IPv6 literals only works
+ * if the SCDynamicStoreCopyProxies system function gets called first. As
+ * Curl currently doesn't support system-wide HTTP proxies, we therefore
+ * don't use any value this function might return.
+ *
+ * This function is only available on a macOS and is not needed for
+ * IPv4-only builds, hence the conditions above.
+ */
+ SCDynamicStoreCopyProxies(NULL);
+#endif
+
#ifndef USE_RESOLVE_ON_IPS
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)