xref: /freebsd/usr.bin/fetch/fetch.1 (revision 2494e810b8339b6e8870322fd08304d5e7775218)
11130b656SJordan K. Hubbard.\" $FreeBSD$
27fefc698SJordan K. Hubbard.Dd July 2, 1996
37fefc698SJordan K. Hubbard.Dt FETCH 1
47fefc698SJordan K. Hubbard.Os
57fefc698SJordan K. Hubbard.Sh NAME
67fefc698SJordan K. Hubbard.Nm fetch
77fefc698SJordan K. Hubbard.Nd retrieve a file by Uniform Resource Locator
87fefc698SJordan K. Hubbard.Sh SYNOPSIS
97fefc698SJordan K. Hubbard.Nm fetch
102494e810SGarrett Wollman.Op Fl MPamnpqr
117fefc698SJordan K. Hubbard.Op Fl o Ar file
127fefc698SJordan K. Hubbard.Ar URL
137fefc698SJordan K. Hubbard.Nm fetch
1478be3199SGarrett Wollman.Op Fl MPRmnpqr
157fefc698SJordan K. Hubbard.Op Fl o Ar file
167fefc698SJordan K. Hubbard.Op Fl c Ar dir
177fefc698SJordan K. Hubbard.Fl f Ar file
187fefc698SJordan K. Hubbard.Fl h Ar host
197fefc698SJordan K. Hubbard.Sh DESCRIPTION
207fefc698SJordan K. Hubbard.Nm fetch
217fefc698SJordan K. Hubbardallows a user to transfer files from a remote network site using
227fefc698SJordan K. Hubbardeither the
237fefc698SJordan K. Hubbard.Em ftp
247fefc698SJordan K. Hubbardor the
257fefc698SJordan K. Hubbard.Em http
267fefc698SJordan K. Hubbardprotocol. In the first form of the command, the
277fefc698SJordan K. Hubbard.Ar URL
287fefc698SJordan K. Hubbardmay be of the form
2978be3199SGarrett Wollman.Li http://site.domain/path/to/the/file
307fefc698SJordan K. Hubbardor
3178be3199SGarrett Wollman.Li ftp://site.domain/path/to/the/file.
3278be3199SGarrett WollmanTo denote a local filename to be copied or linked to (see the
33fc6fcbf9SJordan K. Hubbard.Fl l
3478be3199SGarrett Wollmanflag below), the
35fc6fcbf9SJordan K. Hubbard.Em file:/path/to/the/file
36fc6fcbf9SJordan K. HubbardURL form is used.
3778be3199SGarrett Wollman.Pp
387fefc698SJordan K. HubbardThe second form of the command can be used to get a file using the
3978be3199SGarrett Wollman.Tn FTP
407fefc698SJordan K. Hubbardprotocol, specifying the file name and the remote host with the
417fefc698SJordan K. Hubbard.Fl h
427fefc698SJordan K. Hubbardand the
437fefc698SJordan K. Hubbard.Fl f
447fefc698SJordan K. Hubbardflags.
457fefc698SJordan K. Hubbard.Pp
467fefc698SJordan K. HubbardThe following options are available:
477fefc698SJordan K. Hubbard.Bl -tag -width Fl -compact
482494e810SGarrett Wollman.It Fl a
492494e810SGarrett WollmanAutomatically retry the transfer upon soft failures.
5078be3199SGarrett Wollman.It Fl c Ar dir
5178be3199SGarrett WollmanThe file to retrieve is in directory
5278be3199SGarrett Wollman.Ar dir
5378be3199SGarrett Wollmanon the remote host.
5478be3199SGarrett Wollman.It Fl f Ar file
5578be3199SGarrett WollmanThe file to retrieve is named
5678be3199SGarrett Wollman.Ar file
5778be3199SGarrett Wollmanon the remote host.
5878be3199SGarrett Wollman.It Fl h Ar host
5978be3199SGarrett WollmanThe file to retrieve is located on the host
6078be3199SGarrett Wollman.Ar host .
6178be3199SGarrett Wollman.It Fl l
6278be3199SGarrett WollmanIf target is a
6378be3199SGarrett Wollman.Ar file:/
6478be3199SGarrett Wollmanstyle of URL, make a link to the target rather than trying
6578be3199SGarrett Wollmanto copy it.
667fefc698SJordan K. Hubbard.It Fl M
677fefc698SJordan K. Hubbard.It Fl m
687fefc698SJordan K. HubbardMirror mode: Set the modification time of the file so that it is
697fefc698SJordan K. Hubbardidentical to the modification time of the file at the remote host.
707fefc698SJordan K. HubbardIf the file already exists on the local host and is identical (as
717fefc698SJordan K. Hubbardgauged by size and modification time), no transfer is done.
726b5c2db2SJordan K. Hubbard.It Fl n
736b5c2db2SJordan K. HubbardDon't preserve the modtime of the transfered file, use the current time.
7478be3199SGarrett Wollman.It Fl o Ar file
7578be3199SGarrett WollmanSet the output file name to
7678be3199SGarrett Wollman.Ar file .
7778be3199SGarrett WollmanBy default, a ``pathname'' is extracted from the specified URI, and
7878be3199SGarrett Wollmanits basename is used as the name of the output file.  A
7978be3199SGarrett Wollman.Ar file
8078be3199SGarrett Wollmanargument of
8178be3199SGarrett Wollman.Sq Li \&-
8278be3199SGarrett Wollmanindicates that results are to be directed to the standard output.
837fefc698SJordan K. Hubbard.It Fl P
847fefc698SJordan K. Hubbard.It Fl p
8578be3199SGarrett WollmanUse the passive mode of the
8678be3199SGarrett Wollman.Tn FTP
8778be3199SGarrett Wollmanprotocol.  This is useful for crossing certain sorts of firewalls.
8878be3199SGarrett Wollman.It Fl q
8978be3199SGarrett WollmanQuiet mode. Do not report transfer progress on the terminal.
9078be3199SGarrett Wollman.It Fl R
9178be3199SGarrett WollmanThe filenames specified are ``precious'', and should not be deleted
9278be3199SGarrett Wollmanunder any circumstances, even if the transfer failed or was incomplete.
9378be3199SGarrett Wollman.It Fl r
9478be3199SGarrett WollmanRestart a previously interrupted transfer.
95fc6fcbf9SJordan K. Hubbard.It Fl T Ar seconds
96fc6fcbf9SJordan K. HubbardSet timeout value to
97fc6fcbf9SJordan K. Hubbard.Ar seconds.
98a43a248cSPeter WemmOverrides the environment variables
99fc6fcbf9SJordan K. Hubbard.Ev FTP_TIMEOUT
100a43a248cSPeter Wemmfor ftp transfers or
101a43a248cSPeter Wemm.Ev HTTP_TIMEOUT
102a43a248cSPeter Wemmfor http transfers if set.
1037ae26f14SJordan K. Hubbard.It Fl v
10478be3199SGarrett WollmanIncrease verbosity.  More
10578be3199SGarrett Wollman.Fl v Ns \&'s
10678be3199SGarrett Wollmanresult in more information.
1077fefc698SJordan K. Hubbard.El
10878be3199SGarrett Wollman.Pp
10978be3199SGarrett WollmanMany options are also controlled solely by the environment (this is a
11078be3199SGarrett Wollmanbug).
11178be3199SGarrett Wollman.Sh PROXY SERVERS
11278be3199SGarrett WollmanMany sites use application gateways (``proxy servers'') in their
11378be3199SGarrett Wollmanfirewalls in order to allow communication across the firewall using a
11478be3199SGarrett Wollmantrusted protocol.  The
11578be3199SGarrett Wollman.Nm fetch
11678be3199SGarrett Wollmanprogram can use both the
11778be3199SGarrett Wollman.Tn FTP
11878be3199SGarrett Wollmanand the
11978be3199SGarrett Wollman.Tn HTTP
12078be3199SGarrett Wollmanprotocol with a proxy server.
12178be3199SGarrett Wollman.Tn FTP
12278be3199SGarrett Wollmanproxy servers can only relay
12378be3199SGarrett Wollman.Tn FTP
12478be3199SGarrett Wollmanrequests;
12578be3199SGarrett Wollman.Tn HTTP
12678be3199SGarrett Wollmanproxy servers can relay both
12778be3199SGarrett Wollman.Tn FTP
12878be3199SGarrett Wollmanand
12978be3199SGarrett Wollman.Tn HTTP
13078be3199SGarrett Wollmanrequests.
13178be3199SGarrett WollmanA proxy server can be configured by defining an environment variable
13278be3199SGarrett Wollmannamed
13378be3199SGarrett Wollman.Dq Va PROTO Ns Ev _PROXY ,
13478be3199SGarrett Wollmanwhere
13578be3199SGarrett Wollman.Va PROTO
13678be3199SGarrett Wollmanis the name of the protocol in upper case.  The value of the
13778be3199SGarrett Wollmanenvironment variable specifies a hostname, optionally followed by a
13878be3199SGarrett Wollmancolon and a port number.
13978be3199SGarrett Wollman.Pp
14078be3199SGarrett WollmanThe
14178be3199SGarrett Wollman.Tn FTP
14278be3199SGarrett Wollmanproxy client specifies
14378be3199SGarrett Wollman.Dq anonymous
14478be3199SGarrett Wollmanas its user name, and passes the remote user name and host as the
14578be3199SGarrett Wollman.Tn FTP
14678be3199SGarrett Wollmansession's password, in the form
14778be3199SGarrett Wollman.Dq Va remoteuser Ns Li \&@ Va remotehost .
14878be3199SGarrett WollmanThe
14978be3199SGarrett Wollman.Tn HTTP
15078be3199SGarrett Wollmanproxy client simply passes the originally-requested URI to the remote
15178be3199SGarrett Wollmanserver in an
15278be3199SGarrett Wollman.Tn HTTP
15378be3199SGarrett Wollman.Dq Li GET
15478be3199SGarrett Wollmanrequest.  HTTP proxy authentication is not yet implemented.
15578be3199SGarrett WollmanWhen multiple proxy protcols are configured,
15678be3199SGarrett Wollman.Nm
15778be3199SGarrett Wollmanwill prefer
15878be3199SGarrett Wollman.Tn HTTP .
1597fefc698SJordan K. Hubbard.Sh ENVIRONMENT
16078be3199SGarrett Wollman.Bl -tag -width FTP_PASSIVE_MODE -offset indent
16178be3199SGarrett Wollman.It Ev FTP_TIMEOUT
16278be3199SGarrett Wollmanmaximum time, in seconds, to wait before aborting an
16378be3199SGarrett Wollman.Tn FTP
16478be3199SGarrett Wollmanconnection.
16578be3199SGarrett Wollman.It Ev HTTP_TIMEOUT
16678be3199SGarrett Wollmanmaximum time, in seconds, to wait before aborting an
16778be3199SGarrett Wollman.Tn HTTP
16878be3199SGarrett Wollmanconnection.
16978be3199SGarrett Wollman.It Ev FTP_LOGIN
17078be3199SGarrett Wollmanthe login name used for
17178be3199SGarrett Wollman.Tn FTP
17278be3199SGarrett Wollmantransfers (default
17378be3199SGarrett Wollman.Dq Li anonymous )
17478be3199SGarrett Wollman.It Ev FTP_PASSWORD
17578be3199SGarrett Wollmanthe password used for
17678be3199SGarrett Wollman.Tn FTP
17778be3199SGarrett Wollmantransfers (default
17878be3199SGarrett Wollman.Dq Va yourname Ns Li \&@ Ns Va yourhost )
17978be3199SGarrett Wollman.It Ev FTP_PASSIVE_MODE
18078be3199SGarrett Wollmanforce the use of passive mode FTP
18178be3199SGarrett Wollman.It Ev HTTP_PROXY
18278be3199SGarrett Wollmanthe address of a proxy server which understands
18378be3199SGarrett Wollman.Tn HTTP
18478be3199SGarrett Wollman.It Ev FTP_PROXY
18578be3199SGarrett Wollmanthe address of a proxy server which understands
18678be3199SGarrett Wollman.Tn FTP
1877fefc698SJordan K. Hubbard.Sh SEE ALSO
188da1ff3cbSWolfram Schneider.Xr ftp 1 ,
189da1ff3cbSWolfram Schneider.Xr tftp 1
1907fefc698SJordan K. Hubbard.Sh HISTORY
1917fefc698SJordan K. HubbardThe
1927fefc698SJordan K. Hubbard.Nm fetch
19385cf659aSMike Pritchardcommand appeared in
19485cf659aSMike Pritchard.Fx 2.1.5 .
19578be3199SGarrett Wollman.Sh AUTHORS
19678be3199SGarrett WollmanThe original implementation of
19778be3199SGarrett Wollman.Nm
19878be3199SGarrett Wollmanwas done by Jean-Marc Zucconi.  It was extensively re-worked for
19978be3199SGarrett Wollman.Fx 3.0
20078be3199SGarrett Wollmanby Garrett Wollman.
2012494e810SGarrett Wollman.Sh BUGS
2022494e810SGarrett WollmanThere are too many environment variables and command-line options.
2032494e810SGarrett Wollman.Pp
2042494e810SGarrett WollmanThe
2052494e810SGarrett Wollman.Fl a
2062494e810SGarrett Wollmanoption is only implemented for certain kinds of
2072494e810SGarrett Wollman.Tn HTTP
2082494e810SGarrett Wollmanfailures, and no
2092494e810SGarrett Wollman.Tn FTP
2102494e810SGarrett Wollmanfailures.
2112494e810SGarrett Wollman.Pp
2122494e810SGarrett Wollman.Tn HTTP
2132494e810SGarrett Wollmanauthentication is not yet implememnted.
214