diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-01-03 17:00:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-01-03 17:00:05 +0000 |
commit | 0368e7c3e95080eb552e45cb58d04e6f86f7297a (patch) | |
tree | 471a99ebe19a933a97f1d20b22d8f260e7290710 /usr.bin/ftp/main.c | |
parent | d74cd9a5b0398853b0296d92aeb24c9a0d334e1f (diff) |
Add a "-w connect_timeout" option in support of URL-fetching. This allows
slow / failing connects to be identified. The install script needs this
functionaly.
ok jca rpe millert
Diffstat (limited to 'usr.bin/ftp/main.c')
-rw-r--r-- | usr.bin/ftp/main.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index c16f43c9ea1..e7a3c17db97 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.115 2016/12/28 17:48:04 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.116 2017/01/03 17:00:04 deraadt Exp $ */ /* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */ /* @@ -80,6 +80,8 @@ #include "cmds.h" #include "ftp_var.h" +int connect_timeout; + #ifndef NOSSL char * const ssl_verify_opts[] = { #define SSL_CAFILE 0 @@ -274,7 +276,7 @@ main(volatile int argc, char *argv[]) httpuseragent = NULL; while ((ch = getopt(argc, argv, - "46AaCc:dD:Eegik:Mmno:pP:r:S:s:tU:vV")) != -1) { + "46AaCc:dD:Eegik:Mmno:pP:r:S:s:tU:vVw:")) != -1) { switch (ch) { case '4': family = PF_INET; @@ -417,6 +419,11 @@ main(volatile int argc, char *argv[]) verbose = 0; break; + case 'w': + connect_timeout = strtonum(optarg, 0, 200, &errstr); + if (errstr) + errx(1, "-w: %s", errstr); + break; default: usage(); } @@ -919,17 +926,18 @@ usage(void) " ftp://[user:password@]host[:port]/file[/] ...\n" " ftp [-C] [-c cookie] [-o output] [-S ssl_options] " "[-s srcaddr]\n" - " [-U useragent] " + " [-U useragent] [-w seconds] " "http[s]://[user:password@]host[:port]/file ...\n" " ftp [-C] [-o output] [-s srcaddr] file:file ...\n" " ftp [-C] [-o output] [-s srcaddr] host:/file[/] ...\n" #else /* !SMALL */ - "ftp [-o output] ftp://[user:password@]host[:port]/file[/] ...\n" + "ftp [-o output] " + "ftp://[user:password@]host[:port]/file[/] ...\n" #ifndef NOSSL - " ftp [-o output] [-S ssl_options] " + " ftp [-o output] [-S ssl_options] [-w seconds] " "http[s]://[user:password@]host[:port]/file ...\n" #else - " ftp [-o output] http://host[:port]/file ...\n" + " ftp [-o output] [-w seconds] http://host[:port]/file ...\n" #endif /* NOSSL */ " ftp [-o output] file:file ...\n" " ftp [-o output] host:/file[/] ...\n" |