diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2012-12-16 16:11:05 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2012-12-16 16:11:05 -0300 |
commit | 238b6ae1b5338a7169b0171d312d5829e2ca62fb (patch) | |
tree | cfaf2b571e1168c214c058614e6d3e6fd0c1ef0e | |
parent | d385ca95263115bc33b220df3caca69e7018f5bd (diff) |
Set the FTP dpi to one try per connection
Bug fix: also avoid a useless retry when given just the server name.
-rw-r--r-- | dpi/ftp.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -154,7 +154,7 @@ static void make_wget_argv(char *url) char *esc_url; if (dl_argv) { - dFree(dl_argv[2]); + dFree(dl_argv[3]); dFree(dl_argv); } dl_argv = dNew(char*, 10); @@ -164,9 +164,10 @@ static void make_wget_argv(char *url) Filter_smtp_hack(esc_url); dl_argv[0] = "wget"; - dl_argv[1] = "-O-"; - dl_argv[2] = esc_url; - dl_argv[3] = NULL; + dl_argv[1] = "-t1"; /* try once, default is 20 */ + dl_argv[2] = "-O-"; + dl_argv[3] = esc_url; + dl_argv[4] = NULL; } /* @@ -187,6 +188,8 @@ static int try_ftp_transfer(char *url) int aborted = 0; int DataPipe[2]; + MSG("try_ftp_transfer: url=%s\n", url); + if (pipe(DataPipe) < 0) { MSG("pipe, %s\n", dStrerror(errno)); return 0; @@ -316,7 +319,8 @@ int main(int argc, char **argv) if ((st = try_ftp_transfer(url)) == -1) { /* Transfer failed, the requested file may not exist or be a symlink * to a directory. Try again... */ - if ((p = strrchr(url, '/')) && p[1]) { + if ((p = strrchr(url, '/')) && p[1] && + p > url && p[-1] != '/') { url2 = dStrconcat(url, "/", NULL); st = try_ftp_transfer(url2); } |