IPv6-adjustments
This commit is contained in:
Родитель
46e0937263
Коммит
da06a6e7e3
|
@ -1058,7 +1058,7 @@ again:;
|
|||
* previous lookup.
|
||||
*/
|
||||
#ifdef ENABLE_IPV6
|
||||
res = conn->res;
|
||||
res = conn->hp;
|
||||
#else
|
||||
he = conn->hp;
|
||||
#endif
|
||||
|
|
|
@ -390,7 +390,7 @@ static const short yycheck[] = { 0,
|
|||
56
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/usr/local/share/bison.simple"
|
||||
#line 3 "/usr/lib/bison.simple"
|
||||
/* This file comes from bison-1.28. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
|
@ -604,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#line 217 "/usr/local/share/bison.simple"
|
||||
#line 217 "/usr/lib/bison.simple"
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
into yyparse. The argument should have type void *.
|
||||
|
@ -1295,7 +1295,7 @@ case 50:
|
|||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 543 "/usr/local/share/bison.simple"
|
||||
#line 543 "/usr/lib/bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
|
|
42
lib/url.c
42
lib/url.c
|
@ -547,8 +547,8 @@ CURLcode curl_disconnect(CURLconnect *c_connect)
|
|||
free(conn->proto.generic);
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
if(conn->res) /* host name info */
|
||||
freeaddrinfo(conn->res);
|
||||
if(conn->hp) /* host name info */
|
||||
freeaddrinfo(conn->hp);
|
||||
#else
|
||||
if(conn->hostent_buf) /* host name info */
|
||||
free(conn->hostent_buf);
|
||||
|
@ -708,6 +708,9 @@ static CURLcode ConnectPlease(struct UrlData *data,
|
|||
conn->hp->h_addr, conn->hp->h_length);
|
||||
conn->serv_addr.sin_family = conn->hp->h_addrtype;
|
||||
conn->serv_addr.sin_port = htons(data->port);
|
||||
#else
|
||||
/* IPv6-style */
|
||||
struct addrinfo *ai;
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32)||defined(__CYGWIN32__)
|
||||
|
@ -836,21 +839,22 @@ static CURLcode ConnectPlease(struct UrlData *data,
|
|||
* Connect to server/proxy
|
||||
*************************************************************/
|
||||
#ifdef ENABLE_IPV6
|
||||
data->firstsocket = -1;
|
||||
for (ai = conn->res; ai; ai = ai->ai_next) {
|
||||
data->firstsocket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||
if (data->firstsocket < 0)
|
||||
conn->firstsocket = -1;
|
||||
for (ai = conn->hp; ai; ai = ai->ai_next) {
|
||||
conn->firstsocket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||
if (conn->firstsocket < 0)
|
||||
continue;
|
||||
|
||||
if (connect(data->firstsocket, ai->ai_addr, ai->ai_addrlen) < 0) {
|
||||
close(data->firstsocket);
|
||||
data->firstsocket = -1;
|
||||
if (connect(conn->firstsocket, ai->ai_addr, ai->ai_addrlen) < 0) {
|
||||
close(conn->firstsocket);
|
||||
conn->firstsocket = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if (data->firstsocket < 0) {
|
||||
conn->ai = ai;
|
||||
if (conn->firstsocket < 0) {
|
||||
failf(data, strerror(errno));
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
@ -923,9 +927,6 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
|
|||
struct sigaction sigact;
|
||||
#endif
|
||||
int urllen;
|
||||
#ifdef ENABLE_IPV6
|
||||
struct addrinfo *ai;
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
* Check input data
|
||||
|
@ -1562,17 +1563,16 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
|
|||
data->port = data->remote_port; /* it is the same port */
|
||||
|
||||
/* Resolve target host right on */
|
||||
if(!conn->hp) {
|
||||
#ifdef ENABLE_IPV6
|
||||
if(!conn->res)
|
||||
/* it might already be set if reusing a connection */
|
||||
conn->res = Curl_getaddrinfo(data, conn->name, data->port);
|
||||
if(!conn->res)
|
||||
conn->hp = Curl_getaddrinfo(data, conn->name, data->port);
|
||||
#else
|
||||
if(!conn->hp)
|
||||
/* it might already be set if reusing a connection */
|
||||
conn->hp = Curl_gethost(data, conn->name, &conn->hostent_buf);
|
||||
if(!conn->hp)
|
||||
#endif
|
||||
}
|
||||
if(!conn->hp)
|
||||
{
|
||||
failf(data, "Couldn't resolve host '%s'", conn->name);
|
||||
return CURLE_COULDNT_RESOLVE_HOST;
|
||||
|
@ -1702,6 +1702,8 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
|
|||
#else
|
||||
const int niflags = NI_NUMERICHOST;
|
||||
#endif
|
||||
struct addrinfo *ai = conn->ai;
|
||||
|
||||
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, hbuf, sizeof(hbuf), NULL, 0,
|
||||
niflags)) {
|
||||
snprintf(hbuf, sizeof(hbuf), "?");
|
||||
|
@ -1751,8 +1753,8 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
|||
if(conn->path)
|
||||
free(conn->path);
|
||||
#ifdef ENABLE_IPV6
|
||||
if(conn->res)
|
||||
freeaddrinfo(conn->res);
|
||||
if(conn->hp)
|
||||
freeaddrinfo(conn->hp);
|
||||
#else
|
||||
if(conn->hostent_buf)
|
||||
free(conn->hostent_buf);
|
||||
|
|
|
@ -218,7 +218,8 @@ struct connectdata {
|
|||
#define PROT_FILE (1<<8)
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
struct addrinfo *res;
|
||||
struct addrinfo *hp; /* host info pointer list */
|
||||
struct addrinfo *ai; /* the particular host we use */
|
||||
#else
|
||||
char *hostent_buf; /* pointer to allocated memory for name info */
|
||||
struct hostent *hp;
|
||||
|
|
Загрузка…
Ссылка в новой задаче