mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix FTP PASV output.
Published in <sxslmgsfkgj.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
3d6a62fdb9
commit
9656223552
@ -1,3 +1,9 @@
|
||||
2001-11-27 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* 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 <hniksic@arsdigita.com>
|
||||
|
||||
* progress.c: Change the default progress implementation to "bar".
|
||||
|
@ -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;
|
||||
|
@ -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 *));
|
||||
|
||||
|
23
src/ftp.c
23
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user