mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Added CURLOPT_IPRESOLVE support
This commit is contained in:
parent
09ccfcdcd4
commit
2297eca103
5
CHANGES
5
CHANGES
@ -8,6 +8,11 @@
|
||||
|
||||
|
||||
Daniel (19 September)
|
||||
- Added the CURLOPT_IPRESOLVE option, that allows an application to select
|
||||
what kind of IP addresses he wants to use when resolving host names. This
|
||||
is only interesting when using host names that resolve addresses using more
|
||||
than one version of IP.
|
||||
|
||||
- Applied Markus Moeller's patch that introduces SPNEGO support if libcurl
|
||||
is built with the FBopenssl libraries. curl_version_info() now returns
|
||||
info on SPNEGO availability. The patch also made the GSSAPI stuff work fine
|
||||
|
@ -678,15 +678,28 @@ typedef enum {
|
||||
Note that setting multiple bits may cause extra network round-trips. */
|
||||
CINIT(PROXYAUTH, LONG, 111),
|
||||
|
||||
/* FPT Option that changes the timeout, in seconds, associated with
|
||||
/* FTP option that changes the timeout, in seconds, associated with
|
||||
getting a response. This is different from transfer timeout time and
|
||||
essentially places a demand on the FTP server to acknowledge commands
|
||||
in a timely manner. */
|
||||
CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
|
||||
|
||||
/* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
|
||||
tell libcurl to resolve names to those IP versions only. This only has
|
||||
affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
|
||||
CINIT(IPRESOLVE, LONG, 113),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
/* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
|
||||
name resolves addresses using more than one IP protocol version, this
|
||||
option might be handy to force libcurl to use a specific IP version. */
|
||||
#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
|
||||
versions that your system allows */
|
||||
#define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
|
||||
#define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
|
||||
|
||||
/* two convenient "aliases" that follow the name scheme better */
|
||||
#define CURLOPT_WRITEDATA CURLOPT_FILE
|
||||
#define CURLOPT_READDATA CURLOPT_INFILE
|
||||
|
20
lib/hostip.c
20
lib/hostip.c
@ -653,7 +653,7 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
|
||||
struct addrinfo hints, *res;
|
||||
int error;
|
||||
char sbuf[NI_MAXSERV];
|
||||
int s, pf = PF_UNSPEC;
|
||||
int s, pf;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
*waitp=0; /* don't wait, we have the response now */
|
||||
@ -665,11 +665,27 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
|
||||
* when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if
|
||||
* the stack seems to be a non-ipv6 one. */
|
||||
pf = PF_INET;
|
||||
else
|
||||
else {
|
||||
/* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest
|
||||
* possible checks. And close the socket again.
|
||||
*/
|
||||
sclose(s);
|
||||
|
||||
/*
|
||||
* Check if a more limited name resolve has been requested.
|
||||
*/
|
||||
switch(data->set.ip_version) {
|
||||
case CURL_IPRESOLVE_V4:
|
||||
pf = PF_INET;
|
||||
break;
|
||||
case CURL_IPRESOLVE_V6:
|
||||
pf = PF_INET6;
|
||||
break;
|
||||
default:
|
||||
pf = PF_UNSPEC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = pf;
|
||||
|
@ -826,6 +826,8 @@ struct UserDefined {
|
||||
char *private; /* Private data */
|
||||
|
||||
struct curl_slist *http200aliases; /* linked list of aliases for http200 */
|
||||
|
||||
int ip_version;
|
||||
|
||||
/* Here follows boolean settings that define how to behave during
|
||||
this session. They are STATIC, set by libcurl users or at least initially
|
||||
|
Loading…
Reference in New Issue
Block a user