On Wed, Aug 15, 2012 at 06:09:34AM +0100, Jason McIntyre wrote:
> On Tue, Aug 14, 2012 at 10:38:21PM -0400, Lawrence Teo wrote:
> > This is a small follow-up diff to haesbaert@'s recent commit that
> > enables HTTP Basic authentication in ftp(1):
> > 
> > * In the AUTO-FETCHING FILES section of the ftp(1) man page, describe
> >   what [user:password@] does when used with HTTP and HTTPS URLs.
> > 
> > * Fix usage formatting to match man page SYNOPSIS exactly.
> > 
> > * Fix usage to hide [user:password@] for http/https when compiled
> >   with -DSMALL.
> > 
> > Thoughts? OK?
> > 
> 
> i'm ok with this, but i wonder if we couldn;t make things less verbose:
> 
> - combine the http and https lines, at least in SYNOPSIS/usage(), into
>   one http[s] line.

I was slightly hesitant about this at first, but now that I've tried it
I like how nice and compact it is. :)  Hopefully using "http[s]" in the
man page source is the right way to do it, but if I should be using a
macro for the square brackets instead, please let me know and I'll fix
it.

> - there is some scope at the beginning of the AUTO-FETCHING FILES
>   section to describe "user" and "password", and avoid having to repeat
>   the text three times. i know it combines withstuff about proxys
>   (proxies?).

This is slightly trickier since the way "user" and "password" works for
FTP v.s. HTTP/HTTPS is not the same.  I did manage to reduce the
repetitiveness somewhat by describing them at the beginning of
AUTO-FETCHING FILES as you suggested.  If you have thoughts on how the
text can be improved, I'll be glad to change it.

Thank you,
Lawrence


Index: ftp.1
===================================================================
RCS file: /cvs/src/usr.bin/ftp/ftp.1,v
retrieving revision 1.83
diff -u -p -r1.83 ftp.1
--- ftp.1       14 Aug 2012 20:47:08 -0000      1.83
+++ ftp.1       16 Aug 2012 02:05:48 -0000
@@ -61,18 +61,7 @@
 .Op Fl o Ar output
 .Op Fl s Ar srcaddr
 .Sm off
-.No http:// Oo Ar user : password No @
-.Oc Ar host Oo : Ar port
-.Oc No / Ar file
-.Sm on
-.Ar ...
-.Nm ftp
-.Op Fl C
-.Op Fl c Ar cookie
-.Op Fl o Ar output
-.Op Fl s Ar srcaddr
-.Sm off
-.No https:// Oo Ar user : password No @
+.No http[s]:// Oo Ar user : password No @
 .Oc Ar host Oo : Ar port
 .Oc No / Ar file
 .Sm on
@@ -1260,6 +1249,29 @@ supports an auto-fetch feature.
 To enable auto-fetch, simply pass the list of hostnames/files
 on the command line.
 .Pp
+If
+.Ar user : Ns Ar password Ns @
+is given for an FTP URL and
+.Ev ftp_proxy
+isn't defined,
+.Nm
+will log in as
+.Ar user
+with a password of
+.Ar password .
+Similarly, if
+.Ar user : Ns Ar password Ns @
+is given for an HTTP or HTTPS URL and
+.Ev http_proxy
+isn't defined,
+.Nm
+will authenticate as
+.Ar user
+with a password of
+.Ar password
+to retrieve the URL using Basic authentication as defined in
+RFC 2617.
+.Pp
 The following formats are valid syntax for an auto-fetch element:
 .Bl -tag -width Ds
 .It host:/file[/]
@@ -1272,14 +1284,6 @@ An FTP URL, retrieved using the FTP prot
 isn't defined.
 Otherwise, transfer using HTTP via the proxy defined in
 .Ev ftp_proxy .
-If
-.Ar user : Ns Ar password Ns @
-is given and
-.Ev ftp_proxy
-isn't defined, log in as
-.Ar user
-with a password of
-.Ar password .
 .It http://[user:password@]host[:port]/file
 An HTTP URL, retrieved using the HTTP protocol.
 If
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/main.c,v
retrieving revision 1.84
diff -u -p -r1.84 main.c
--- main.c      14 Aug 2012 20:47:08 -0000      1.84
+++ main.c      16 Aug 2012 01:49:48 -0000
@@ -778,13 +778,15 @@ usage(void)
            "[-s srcaddr]\n"
            "           "
 #endif /* !SMALL */
-           "http://[user:password@]host[:port]/file ...\n"
+           "http"
 #ifndef SMALL
-           "       %s [-C] [-c cookie] [-o output] [-s srcaddr]\n"
-           "           "
-           "https://[user:password@]host[:port]/file\n";
-           "           ...\n"
-#endif /* !SMALL */
+           "[s]"
+#endif
+           "://"
+#ifndef SMALL
+           "[user:password@]"
+#endif
+           "host[:port]/file ...\n"
            "       %s "
 #ifndef SMALL
            "[-C] "
@@ -804,8 +806,7 @@ usage(void)
 #endif /* !SMALL */
            "host:/file[/] ...\n",
 #ifndef SMALL
-           __progname, __progname, __progname, __progname, __progname,
-           __progname);
+           __progname, __progname, __progname, __progname, __progname);
 #else /* !SMALL */
            __progname, __progname, __progname, __progname);
 #endif /* !SMALL */

Reply via email to