jasonacox / Build-OpenSSL-cURL

Scripts to build OpenSSL, HTTP/2 (nghttp2) and cURL (libcurl) for MacOS, iOS and tvOS devices (x86_64, armv7, armv7s, arm64, arm64e). Now Supporting Apple Silicon, OpenSSL 3.0.x with TLS 1.3 and Mac Catalyst builds.
MIT License
430 stars 129 forks source link

It is not support IPV6. #11

Closed pjbruce closed 8 years ago

pjbruce commented 8 years ago

How can I enable IPV6?

Thanks.

jasonacox commented 8 years ago

IPv6 is enabled by default in the build. Make sure your workstation and local router are set up for IPv6 and you should be able to hit an IPv6 site like: https://ipv6.google.com/?gws_rd=ssl

Test:

$ curl -v https://ipv6.google.com/?gws_rd=ssl
*   Trying 2607:f8b0:4007:808::200e...
* Connected to ipv6.google.com (2607:f8b0:4007:808::200e) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.google.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> GET /?gws_rd=ssl HTTP/1.1
> Host: ipv6.google.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 05 Sep 2016 17:09:28 GMT
...

NOTE: If you are trying to specify the IPv6 address, you need to use brackets in the URL, like this:

https://[2607:f8b0:4007:808::200e]/

By default, libcurl will attempt both IPv6 and IPv4 DNS lookup. You can limit this using the options:

curl_easy_setopt(_curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);  // Lookup IPv4 Only
curl_easy_setopt(_curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);  // Lookup IPv6 Only
curl_easy_setopt(_curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);  // Either

Note that libcurl will also cache DNS lookup so the above changes will not go into effect until the cache timeout hits. You can for immediate lookup with this option:

curl_easy_setopt(_curl, CURLOPT_DNS_CACHE_TIMEOUT, 0L); // Disable DNS cache

I hope this help. I'm closing this issue as the script does built IPv6 supported curl. Here is the output from the Mac curl binary:

$ ./curl -V
curl 7.50.1 (i386-apple-darwin) libcurl/7.50.1 OpenSSL/1.0.1t zlib/1.2.5 nghttp2/1.14.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets