summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-05-07 00:04:59 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-05-07 00:04:59 +0000
commit733042773a57370053ff83c859d17454cfc876c8 (patch)
tree8cdf4d0b7be6ced168112dd12f55530573a0f421 /gnu/usr.bin
parentd364f1b11a1e40d6a5a5df38a36eb4451ba6347f (diff)
Re-include a patch missed in the recent upgrade:
When passive FTP fails, switch to active FTP and try again Submitted by Andrew Basterfield <bob@cemetery.homeunix.org>
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c6
-rw-r--r--gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c15
-rw-r--r--gnu/usr.bin/lynx/src/LYGlobalDefs.h2
-rw-r--r--gnu/usr.bin/lynx/src/LYMain.c8
4 files changed, 28 insertions, 3 deletions
diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c
index 8cd3099cbff..960ba11f8e7 100644
--- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c
+++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c
@@ -2948,7 +2948,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);
@@ -3579,7 +3579,7 @@ PUBLIC int HTFTPLoad ARGS4(
}
listen:
- if(!ftp_passive) {
+ if(!ftp_local_passive) {
/* Wait for the connection */
#ifdef INET6
struct sockaddr_storage soc_address;
@@ -3603,7 +3603,7 @@ listen:
}
CTRACE((tfp, "TCP: Accepted new socket %d\n", status));
data_soc = status;
- } /* !ftp_passive */
+ } /* !ftp_local_passive */
#if 0 /* no - this makes the data connection go away too soon (2.8.3dev.22) */
if ((status = send_cmd_nowait("QUIT")) == 1)
diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c
index 829214e8f75..ee8da85d810 100644
--- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c
+++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFile.c
@@ -2060,6 +2060,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 */
@@ -2100,7 +2101,21 @@ PUBLIC int HTLoadFile ARGS4(
FREE(nodename);
FREE(acc_method);
#ifndef DISABLE_FTP
+ ftp_newhost = HTParse(addr, "", PARSE_HOST);
+ if (strcmp(ftp_lasthost, ftp_newhost))
+ ftp_local_passive = ftp_passive;
+
status = HTFTPLoad(addr, anchor, format_out, sink);
+
+ if ( ftp_passive == ftp_local_passive ) {
+ if (( status >= 400 ) || ( status < 0 )) {
+ ftp_local_passive = !ftp_passive;
+ status = HTFTPLoad(addr, anchor, format_out, sink);
+ }
+ }
+
+ free(ftp_lasthost);
+ ftp_lasthost = ftp_newhost;
#endif /* DISABLE_FTP */
return status;
} else {
diff --git a/gnu/usr.bin/lynx/src/LYGlobalDefs.h b/gnu/usr.bin/lynx/src/LYGlobalDefs.h
index a800b37fb1a..f5377472040 100644
--- a/gnu/usr.bin/lynx/src/LYGlobalDefs.h
+++ b/gnu/usr.bin/lynx/src/LYGlobalDefs.h
@@ -178,6 +178,8 @@ extern BOOLEAN emacs_keys; /* TRUE to turn on emacs-like key movement */
extern BOOLEAN error_logging; /* TRUE to mail error messages */
extern BOOLEAN ftp_ok;
extern BOOLEAN ftp_passive; /* TRUE if we want to use passive mode ftp */
+extern BOOLEAN ftp_local_passive;
+extern char *ftp_lasthost;
extern BOOLEAN goto_buffer; /* TRUE if offering default goto URL */
extern BOOLEAN is_www_index;
extern BOOLEAN jump_buffer; /* TRUE if offering default shortcut */
diff --git a/gnu/usr.bin/lynx/src/LYMain.c b/gnu/usr.bin/lynx/src/LYMain.c
index c0770d32015..30eadca5d99 100644
--- a/gnu/usr.bin/lynx/src/LYMain.c
+++ b/gnu/usr.bin/lynx/src/LYMain.c
@@ -174,6 +174,8 @@ PUBLIC BOOLEAN LYJumpFileURL = FALSE; /* always FALSE the first time */
PUBLIC BOOLEAN jump_buffer = JUMPBUFFER; /* TRUE if offering default shortcut */
PUBLIC BOOLEAN goto_buffer = GOTOBUFFER; /* TRUE if offering default goto URL */
PUBLIC BOOLEAN ftp_passive = FTP_PASSIVE; /* TRUE if doing ftp in passive mode */
+PUBLIC BOOLEAN ftp_local_passive;
+PUBLIC char *ftp_lasthost;
PUBLIC BOOLEAN recent_sizechange = FALSE;/* the window size changed recently? */
PUBLIC int user_mode = NOVICE_MODE;
PUBLIC BOOLEAN dump_output_immediately = FALSE;
@@ -887,6 +889,12 @@ PRIVATE void free_lynx_globals NOARGS
FixCharacters();
#endif /* NOT_ASCII */
+ #ifndef DISABLE_FTP
+ /* malloc a sizeof(char) so 1st strcmp() won't dump in HTLoadFile() */
+ ftp_lasthost = (char *)malloc(sizeof(char));
+ *ftp_lasthost = NULL;
+ #endif
+
#ifdef EXP_CHARSET_CHOICE
memset((char*)charset_subsets, 0, sizeof(charset_subset_t)*MAXCHARSETS);
#endif