aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-09-28 07:05:26 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-09-28 07:05:26 +0000
commit48dc74aeccab16febc770ccc5fec7ec96af26a97 (patch)
treed5fce7440267d210d0cab50dc06b618d398fbf8b /lib/ftp.c
parent888d39e0838765cff55c3e98460c187a8ebf95d3 (diff)
more transparant support for IPv6 name resolving
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 65f3dfa86..012373ec5 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1020,19 +1020,19 @@ CURLcode _ftp(struct connectdata *conn)
if(data->set.ftpport) {
if(Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
- h = Curl_gethost(data, myhost, &hostdataptr);
+ h = Curl_getaddrinfo(data, myhost, 0, &hostdataptr);
}
else {
if(strlen(data->set.ftpport)>1)
- h = Curl_gethost(data, data->set.ftpport, &hostdataptr);
+ h = Curl_getaddrinfo(data, data->set.ftpport, 0, &hostdataptr);
if(h)
strcpy(myhost, data->set.ftpport); /* buffer overflow risk */
}
}
if(! *myhost) {
- h=Curl_gethost(data,
- getmyhost(myhost, sizeof(myhost)),
- &hostdataptr);
+ h=Curl_getaddrinfo(data,
+ getmyhost(myhost, sizeof(myhost)),
+ 0, &hostdataptr);
}
infof(data, "We connect from %s\n", myhost);
@@ -1151,11 +1151,11 @@ CURLcode _ftp(struct connectdata *conn)
unsigned short newport; /* remote port, not necessary the local one */
unsigned short connectport; /* the local port connect() should use! */
char newhost[32];
-#ifdef ENABLE_IPV6
- struct addrinfo *res;
-#else
- struct hostent *he;
+
+ Curl_addrinfo *he;
char *hostdataptr=NULL;
+
+#ifndef ENABLE_IPV6
char *ip_addr;
#endif
char *str=buf;
@@ -1192,24 +1192,14 @@ CURLcode _ftp(struct connectdata *conn)
* proxy again here. We already have the name info for it since the
* previous lookup.
*/
-#ifdef ENABLE_IPV6
- res = conn->hp;
-#else
he = conn->hp;
-#endif
connectport =
(unsigned short)conn->port; /* we connect to the proxy's port */
}
else {
/* normal, direct, ftp connection */
-#ifdef ENABLE_IPV6
- res = Curl_getaddrinfo(data, newhost, newport);
- if(!res)
-#else
- he = Curl_gethost(data, newhost, &hostdataptr);
- if(!he)
-#endif
- {
+ he = Curl_getaddrinfo(data, newhost, newport, &hostdataptr);
+ if(!he) {
failf(data, "Can't resolve new host %s", newhost);
return CURLE_FTP_CANT_GET_HOST;
}