aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-02-21 17:15:09 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-02-21 17:15:09 +0000
commitda06a6e7e34d9f1c9c6cf6574aec75f4ed704b9c (patch)
tree3ccbef119adfb65cfa6127d60fb33fc197520502 /lib
parent46e0937263df22f091cb7367182ff6095f73b82e (diff)
IPv6-adjustments
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c2
-rw-r--r--lib/getdate.c6
-rw-r--r--lib/url.c42
-rw-r--r--lib/urldata.h3
4 files changed, 28 insertions, 25 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 8d97719fb..6fd9fd3ac 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1058,7 +1058,7 @@ again:;
* previous lookup.
*/
#ifdef ENABLE_IPV6
- res = conn->res;
+ res = conn->hp;
#else
he = conn->hp;
#endif
diff --git a/lib/getdate.c b/lib/getdate.c
index 7e3cff5df..f49626d0b 100644
--- a/lib/getdate.c
+++ b/lib/getdate.c
@@ -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;
diff --git a/lib/url.c b/lib/url.c
index 7905039b8..71824ad4f 100644
--- a/lib/url.c
+++ b/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);
diff --git a/lib/urldata.h b/lib/urldata.h
index fe098c3f6..d1c770a11 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -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;