diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-05 16:44:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-05 16:44:02 +0000 |
commit | cb801a7b401559cc77722f53dd56c33f145d7e01 (patch) | |
tree | a61c7711d06252d0cd01178c58747b2f9323ec3d /gnu/usr.bin/lynx/WWW | |
parent | d7262d84a62c3c5643680cd3300195bd2c95f93b (diff) |
default to passive, upgrade to active as needed; Andrew Basterfield
list@lostgeneration.freeserve.co.uk
Diffstat (limited to 'gnu/usr.bin/lynx/WWW')
-rw-r--r-- | gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c | 6 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c index 7924b0bacdc..87729de3d7c 100644 --- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c +++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c @@ -2570,7 +2570,7 @@ PUBLIC int HTFTPLoad ARGS4( if (status < 0) return status; - if (!ftp_passive) { + if (!ftp_local_passive) { status = get_listen_socket(); if (status < 0) { NETCLOSE (control->socket); @@ -3133,7 +3133,7 @@ PUBLIC int HTFTPLoad ARGS4( } listen: - if (!ftp_passive) { + if (!ftp_local_passive) { /* Wait for the connection */ struct sockaddr_in soc_address; int soc_addrlen=sizeof(soc_address); @@ -3153,7 +3153,7 @@ listen: } CTRACE(tfp, "TCP: Accepted new socket %d\n", status); data_soc = status; - } /* !ftp_passive */ + } /* !ftp_local_passive */ if (isDirectory) { status = read_directory (anchor, name, format_out, sink); diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c index f0b294e7952..35d77ea679a 100644 --- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c +++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c @@ -1848,6 +1848,7 @@ PUBLIC int HTLoadFile ARGS4( { char * filename = NULL; char * acc_method = NULL; + char * ftp_newhost; HTFormat format; char * nodename = NULL; char * newname = NULL; /* Simplified name of file */ @@ -1886,7 +1887,21 @@ PUBLIC int HTLoadFile ARGS4( FREE(nodename); FREE(acc_method); #ifndef DISABLE_FTP - return HTFTPLoad(addr, anchor, format_out, sink); + ftp_newhost = HTParse(addr, "", PARSE_HOST); /* HTParse mallocs */ + if (strcmp(ftp_lasthost, ftp_newhost)) + ftp_local_passive = ftp_passive; /* set to default */ + + status = HTFTPLoad(addr, anchor, format_out, sink); + + if ( ftp_passive == ftp_local_passive ) { + if (( status <= -4 ) || ( status == -1 )) { + ftp_local_passive = !ftp_passive; + status = HTFTPLoad(addr, anchor, format_out, sink); + } + } + free(ftp_lasthost); + ftp_lasthost = ftp_newhost; + return status; #else return -1; #endif /* DISABLE_FTP */ |