Index: docs/libcurl/curl_easy_setopt.3 =================================================================== RCS file: /cvsroot/curl/curl/docs/libcurl/curl_easy_setopt.3,v retrieving revision 1.222 diff -u -r1.222 curl_easy_setopt.3 --- docs/libcurl/curl_easy_setopt.3 8 Jun 2008 22:00:46 -0000 1.222 +++ docs/libcurl/curl_easy_setopt.3 8 Jul 2008 12:56:11 -0000 @@ -541,6 +541,9 @@ without delay. This is less efficient than sending larger amounts of data at a time, and can contribute to congestion on the network if overdone. +.IP CURLOPT_ADDRESS_SCOPE +Pass an unsigned int specifying the scope_id value to use when +connecting to IPv6 link-local or site-local addresses. .SH NAMES and PASSWORDS OPTIONS (Authentication) .IP CURLOPT_NETRC This parameter controls the preference of libcurl between using user names and Index: include/curl/curl.h =================================================================== RCS file: /cvsroot/curl/curl/include/curl/curl.h,v retrieving revision 1.359 diff -u -r1.359 curl.h --- include/curl/curl.h 3 Jul 2008 06:56:03 -0000 1.359 +++ include/curl/curl.h 8 Jul 2008 12:56:11 -0000 @@ -1211,6 +1211,9 @@ /* Issuer certificate */ CINIT(ISSUERCERT, OBJECTPOINT, 170), + /* Address scope */ + CINIT(ADDRESS_SCOPE, LONG, 171), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; Index: lib/connect.c =================================================================== RCS file: /cvsroot/curl/curl/lib/connect.c,v retrieving revision 1.194 diff -u -r1.194 connect.c --- lib/connect.c 8 Jun 2008 15:52:03 -0000 1.194 +++ lib/connect.c 8 Jul 2008 12:56:11 -0000 @@ -775,6 +775,15 @@ *connected = FALSE; /* default is not connected */ +#ifdef CURLRES_IPV6 + if (conn->data->set.scope + && addr->family == AF_INET6) + { + struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&addr->addr; + in6->sin6_scope_id = conn->data->set.scope; + } +#endif + /* FIXME: do we have Curl_printable_address-like with struct sockaddr* as argument? */ #if defined(HAVE_SYS_UN_H) && defined(AF_UNIX) Index: lib/url.c =================================================================== RCS file: /cvsroot/curl/curl/lib/url.c,v retrieving revision 1.718 diff -u -r1.718 url.c --- lib/url.c 3 Jul 2008 06:56:04 -0000 1.718 +++ lib/url.c 8 Jul 2008 12:56:12 -0000 @@ -2099,6 +2099,10 @@ } break; + case CURLOPT_ADDRESS_SCOPE: + data->set.scope = va_arg(param, unsigned int); + break; + default: /* unknown tag and its companion, just ignore: */ result = CURLE_FAILED_INIT; /* correct this */ Index: lib/urldata.h =================================================================== RCS file: /cvsroot/curl/curl/lib/urldata.h,v retrieving revision 1.382 diff -u -r1.382 urldata.h --- lib/urldata.h 3 Jul 2008 06:56:04 -0000 1.382 +++ lib/urldata.h 8 Jul 2008 12:56:13 -0000 @@ -1477,6 +1477,7 @@ bool proxy_transfer_mode; /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */ + unsigned int scope; /* address scope for IPv6 */ }; struct Names {