Added CURLOPT_IPRESOLVE support

This commit is contained in:
Daniel Stenberg 2003-09-19 15:16:47 +00:00
parent 09ccfcdcd4
commit 2297eca103
4 changed files with 39 additions and 3 deletions

View file

@ -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;

View file

@ -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