cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_IPRESOLVE

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Wed, 14 Apr 2004 13:01:56 +0200

How is this option to be handled? The curl manual on '-6' indicated
it should fail if we cannot resolve to an IPv6 address. The man-page
for curl_easy_setopt seems to take this option only as a hint.

Looking at hostip.c it doesn't seem to enforce either on a non-IPv6
machine. But does a fallback to AF_INET if socket(AF_INET6) fails.
Shouldn't the resolver be decoupled from what socket() accepts?
On Win-XP at least, it's possible to resolve a name to an IPv6 address
w/o an IPv6 stack installed.

IMHO the resolver code should fail if '-6' was specified and an IPv6
address was given or getaddrinfo() doesn't returns any AF_INET6
addresses. Not sure if the last part should fail in url.c (ConnectPlease?).

And this option isn't used in src/main.c. Proposed patch:

--- CVS-lates/src/main.c Wed Apr 07 09:30:41 2004
+++ src/main.c Wed Apr 14 12:07:13 2004
@@ -3356,6 +3356,13 @@
           curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,
                            config->max_filesize);

+ if(4 == config->ip_version)
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+ else if(6 == config->ip_version)
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
+ else
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
+
         /* new in curl 7.11.0 */
         if(config->ftp_ssl)
           curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);

BTW. Does SOCKS5 handle IPv6 addresses?

--gv
Received on 2004-04-14