Module Name: src
Committed By: christos
Date: Sat Dec 22 16:57:10 UTC 2012
Modified Files:
src/usr.bin/ftp: cmds.c cmdtab.c fetch.c ftp.1 main.c
Log Message:
document https support, mentioning certificates are not validated, and obey
https_proxy.
To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/ftp/cmds.c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/ftp/cmdtab.c
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.133 -r1.134 src/usr.bin/ftp/ftp.1
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/ftp/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/cmds.c
diff -u src/usr.bin/ftp/cmds.c:1.134 src/usr.bin/ftp/cmds.c:1.135
--- src/usr.bin/ftp/cmds.c:1.134 Sun Jan 15 15:43:24 2012
+++ src/usr.bin/ftp/cmds.c Sat Dec 22 11:57:09 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cmds.c,v 1.134 2012/01/15 20:43:24 christos Exp $ */
+/* $NetBSD: cmds.c,v 1.135 2012/12/22 16:57:09 christos Exp $ */
/*-
* Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: cmds.c,v 1.134 2012/01/15 20:43:24 christos Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.135 2012/12/22 16:57:09 christos Exp $");
#endif
#endif /* not lint */
@@ -2675,7 +2675,7 @@ setoption(int argc, char *argv[])
return;
}
-#define OPTIONINDENT ((int) sizeof("http_proxy"))
+#define OPTIONINDENT ((int) sizeof("https_proxy"))
if (argc == 1) {
for (o = optiontab; o->name != NULL; o++) {
fprintf(ttyout, "%-*s\t%s\n", OPTIONINDENT,
Index: src/usr.bin/ftp/cmdtab.c
diff -u src/usr.bin/ftp/cmdtab.c:1.51 src/usr.bin/ftp/cmdtab.c:1.52
--- src/usr.bin/ftp/cmdtab.c:1.51 Sun Apr 12 06:18:52 2009
+++ src/usr.bin/ftp/cmdtab.c Sat Dec 22 11:57:09 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cmdtab.c,v 1.51 2009/04/12 10:18:52 lukem Exp $ */
+/* $NetBSD: cmdtab.c,v 1.52 2012/12/22 16:57:09 christos Exp $ */
/*-
* Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: cmdtab.c,v 1.51 2009/04/12 10:18:52 lukem Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.52 2012/12/22 16:57:09 christos Exp $");
#endif
#endif /* not lint */
@@ -298,6 +298,7 @@ struct option optiontab[] = {
{ "anonpass", NULL },
{ "ftp_proxy", NULL },
{ "http_proxy", NULL },
+ { "https_proxy",NULL },
{ "no_proxy", NULL },
{ "pager", NULL },
{ "prompt", NULL },
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.199 src/usr.bin/ftp/fetch.c:1.200
--- src/usr.bin/ftp/fetch.c:1.199 Fri Dec 21 13:07:36 2012
+++ src/usr.bin/ftp/fetch.c Sat Dec 22 11:57:09 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.199 2012/12/21 18:07:36 christos Exp $ */
+/* $NetBSD: fetch.c,v 1.200 2012/12/22 16:57:09 christos Exp $ */
/*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.199 2012/12/21 18:07:36 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.200 2012/12/22 16:57:09 christos Exp $");
#endif /* not lint */
/*
@@ -482,7 +482,7 @@ sigjmp_buf httpabort;
/*
* Retrieve URL, via a proxy if necessary, using HTTP.
* If proxyenv is set, use that for the proxy, otherwise try ftp_proxy or
- * http_proxy as appropriate.
+ * http_proxy/https_proxy as appropriate.
* Supports HTTP redirects.
* Returns 1 on failure, 0 on completed xfer, -1 if ftp connection
* is still open (e.g, ftp xfer with trailing /)
@@ -625,7 +625,9 @@ fetch_url(const char *url, const char *p
int hasleading;
if (proxyenv == NULL) {
- if (IS_HTTP_TYPE(urltype))
+ if (urltype == HTTPS_URL_T)
+ proxyenv = getoptionvalue("https_proxy");
+ if (proxyenv == NULL && IS_HTTP_TYPE(urltype))
proxyenv = getoptionvalue("http_proxy");
else if (urltype == FTP_URL_T)
proxyenv = getoptionvalue("ftp_proxy");
Index: src/usr.bin/ftp/ftp.1
diff -u src/usr.bin/ftp/ftp.1:1.133 src/usr.bin/ftp/ftp.1:1.134
--- src/usr.bin/ftp/ftp.1:1.133 Sun Apr 8 18:00:38 2012
+++ src/usr.bin/ftp/ftp.1 Sat Dec 22 11:57:10 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: ftp.1,v 1.133 2012/04/08 22:00:38 wiz Exp $
+.\" $NetBSD: ftp.1,v 1.134 2012/12/22 16:57:10 christos Exp $
.\"
.\" Copyright (c) 1996-2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -57,7 +57,7 @@
.\"
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
.\"
-.Dd March 5, 2010
+.Dd December 22, 2012
.Dt FTP 1
.Os
.Sh NAME
@@ -1325,7 +1325,7 @@ and
.Ar value
are not given, display all of the options and their values.
The currently supported options are:
-.Bl -tag -width "http_proxy" -offset indent
+.Bl -tag -width "https_proxy" -offset indent
.It Cm anonpass
Defaults to
.Ev $FTPANONPASS
@@ -1335,6 +1335,9 @@ Defaults to
.It Cm http_proxy
Defaults to
.Ev $http_proxy .
+.It Cm https_proxy
+Defaults to
+.Ev $https_proxy .
.It Cm no_proxy
Defaults to
.Ev $no_proxy .
@@ -1742,6 +1745,29 @@ and
(and optionally
.Sq password )
is in the URL, use them for the first attempt to authenticate.
+.\" https://[user[:password]@]host[:port]/path
+.It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
+Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
+An
+.Tn HTTPS
+URL, retrieved using the
+.Tn HTTPS
+protocol.
+If
+.Ic "set https_proxy"
+is defined, it is used as a URL to an
+.Tn HTTPS
+proxy server.
+If
+.Tn HTTPS
+authorization is required to retrieve
+.Ar path ,
+and
+.Sq user
+(and optionally
+.Sq password )
+is in the URL, use them for the first attempt to authenticate.
+There is currently no certificate validation and verification.
.\" file:///path
.It Li file:/// Ns Ar path
A local URL, copied from
Index: src/usr.bin/ftp/main.c
diff -u src/usr.bin/ftp/main.c:1.121 src/usr.bin/ftp/main.c:1.122
--- src/usr.bin/ftp/main.c:1.121 Fri Dec 21 13:07:36 2012
+++ src/usr.bin/ftp/main.c Sat Dec 22 11:57:10 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.121 2012/12/21 18:07:36 christos Exp $ */
+/* $NetBSD: main.c,v 1.122 2012/12/22 16:57:10 christos Exp $ */
/*-
* Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: main.c,v 1.121 2012/12/21 18:07:36 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.122 2012/12/22 16:57:10 christos Exp $");
#endif
#endif /* not lint */
@@ -126,6 +126,7 @@ __RCSID("$NetBSD: main.c,v 1.121 2012/12
#define FTP_PROXY "ftp_proxy" /* env var with FTP proxy location */
#define HTTP_PROXY "http_proxy" /* env var with HTTP proxy location */
+#define HTTPS_PROXY "https_proxy" /* env var with HTTPS proxy location */
#define NO_PROXY "no_proxy" /* env var with list of non-proxied
* hosts, comma or space separated */
@@ -488,6 +489,7 @@ main(int volatile argc, char **volatile
setupoption("anonpass", getenv("FTPANONPASS"), anonpass);
setupoption("ftp_proxy", getenv(FTP_PROXY), "");
setupoption("http_proxy", getenv(HTTP_PROXY), "");
+ setupoption("https_proxy", getenv(HTTPS_PROXY), "");
setupoption("no_proxy", getenv(NO_PROXY), "");
setupoption("pager", getenv("PAGER"), DEFAULTPAGER);
setupoption("prompt", getenv("FTPPROMPT"), DEFAULTPROMPT);