diff --git a/src/ChangeLog b/src/ChangeLog index 04267dae..5b194368 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-11-27 Hrvoje Niksic + + * ftp.c (getftp): Improve output after sending PASV. Don't + attempt to "look up" the IP address we already know; call + connect_to_one directly. + 2001-11-27 Hrvoje Niksic * progress.c: Change the default progress implementation to "bar". diff --git a/src/connect.c b/src/connect.c index 619fd417..c90c214d 100644 --- a/src/connect.c +++ b/src/connect.c @@ -75,8 +75,8 @@ set_connection_host_name (const char *host) } /* Connect to a remote host whose address has been resolved. */ -static int -connect_to_one (unsigned char *addr, unsigned short port, int silent) +int +connect_to_one (const unsigned char *addr, unsigned short port, int silent) { struct sockaddr_in sock_name; int sock, save_errno; diff --git a/src/connect.h b/src/connect.h index 1c378ddb..e9674802 100644 --- a/src/connect.h +++ b/src/connect.h @@ -24,6 +24,7 @@ struct address_list; /* Function declarations */ +int connect_to_one PARAMS ((const unsigned char *, unsigned short, int)); int connect_to_many PARAMS ((struct address_list *, unsigned short, int)); void set_connection_host_name PARAMS ((const char *)); diff --git a/src/ftp.c b/src/ftp.c index 012eacd7..c1c46ec9 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -493,9 +493,6 @@ Error in server response, closing control connection.\n")); { if (opt.ftp_pasv > 0) { - char thost[256]; - unsigned short tport; - if (!opt.server_response) logputs (LOG_VERBOSE, "==> PASV ... "); err = ftp_pasv (&con->rbuf, pasv_addr); @@ -535,31 +532,23 @@ Error in server response, closing control connection.\n")); } if (err==FTPOK) { - struct address_list *al; + unsigned short tport; - sprintf (thost, "%d.%d.%d.%d", - pasv_addr[0], pasv_addr[1], pasv_addr[2], pasv_addr[3]); tport = (pasv_addr[4] << 8) + pasv_addr[5]; - - al = lookup_host (thost, 0); - if (!al) - { - CLOSE (csock); - rbuf_uninitialize (&con->rbuf); - return HOSTERR; - } - dtsock = connect_to_many (al, tport, 0); - address_list_release (al); + dtsock = connect_to_one (pasv_addr, tport, 1); if (dtsock < 0) { int save_errno = errno; CLOSE (csock); rbuf_uninitialize (&con->rbuf); + logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"), + pretty_print_address (pasv_addr), tport, + strerror (save_errno)); return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR; } - passive_mode_open= 1; /* Flag to avoid accept port */ + passive_mode_open = 1; /* Flag to avoid accept port */ if (!opt.server_response) logputs (LOG_VERBOSE, _("done. ")); } /* err==FTP_OK */