wget: URL Format
1
1 2.1 URL Format
1 ==============
1
1 “URL” is an acronym for Uniform Resource Locator. A uniform resource
1 locator is a compact string representation for a resource available via
1 the Internet. Wget recognizes the URL syntax as per RFC1738. This is
1 the most widely used form (square brackets denote optional parts):
1
1 http://host[:port]/directory/file
1 ftp://host[:port]/directory/file
1
1 You can also encode your username and password within a URL:
1
1 ftp://user:password@host/path
1 http://user:password@host/path
1
1 Either USER or PASSWORD, or both, may be left out. If you leave out
1 either the HTTP username or password, no authentication will be sent.
1 If you leave out the FTP username, ‘anonymous’ will be used. If you
1 leave out the FTP password, your email address will be supplied as a
1 default password.(1)
1
1 *Important Note*: if you specify a password-containing URL on the
1 command line, the username and password will be plainly visible to all
1 users on the system, by way of ‘ps’. On multi-user systems, this is a
1 big security risk. To work around it, use ‘wget -i -’ and feed the URLs
1 to Wget’s standard input, each on a separate line, terminated by ‘C-d’.
1
1 You can encode unsafe characters in a URL as ‘%xy’, ‘xy’ being the
1 hexadecimal representation of the character’s ASCII value. Some common
1 unsafe characters include ‘%’ (quoted as ‘%25’), ‘:’ (quoted as ‘%3A’),
1 and ‘@’ (quoted as ‘%40’). Refer to RFC1738 for a comprehensive list of
1 unsafe characters.
1
1 Wget also supports the ‘type’ feature for FTP URLs. By default, FTP
1 documents are retrieved in the binary mode (type ‘i’), which means that
1 they are downloaded unchanged. Another useful mode is the ‘a’ (“ASCII”)
1 mode, which converts the line delimiters between the different operating
1 systems, and is thus useful for text files. Here is an example:
1
1 ftp://host/directory/file;type=a
1
1 Two alternative variants of URL specification are also supported,
1 because of historical (hysterical?) reasons and their widespreaded use.
1
1 FTP-only syntax (supported by ‘NcFTP’):
1 host:/dir/file
1
1 HTTP-only syntax (introduced by ‘Netscape’):
1 host[:port]/dir/file
1
1 These two alternative forms are deprecated, and may cease being
1 supported in the future.
1
1 If you do not understand the difference between these notations, or
1 do not know which one to use, just use the plain ordinary format you use
1 with your favorite browser, like ‘Lynx’ or ‘Netscape’.
1
1 ---------- Footnotes ----------
1
1 (1) If you have a ‘.netrc’ file in your home directory, password will
1 also be searched for there.
1