]> sjero.net Git - wget/blob - doc/wget.texi
[svn] Initial revision
[wget] / doc / wget.texi
1 \input texinfo   @c -*-texinfo-*-
2
3 @c %**start of header
4 @setfilename wget.info
5 @settitle GNU Wget Manual
6 @c Disable the monstrous rectangles beside overfull hbox-es.
7 @finalout
8 @c Use `odd' to print double-sided.
9 @setchapternewpage on
10 @c %**end of header
11
12 @iftex
13 @c Remove this if you don't use A4 paper.
14 @afourpaper
15 @end iftex
16
17 @set VERSION 1.5.3
18 @set UPDATED Sep 1998
19
20 @dircategory Net Utilities
21 @dircategory World Wide Web
22 @direntry
23 * Wget: (wget).         The non-interactive network downloader.
24 @end direntry
25
26 @ifinfo
27 This file documents the the GNU Wget utility for downloading network
28 data.
29
30 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
31
32 Permission is granted to make and distribute verbatim copies of
33 this manual provided the copyright notice and this permission notice
34 are preserved on all copies.
35
36 @ignore
37 Permission is granted to process this file through TeX and print the
38 results, provided the printed document carries a copying permission
39 notice identical to this one except for the removal of this paragraph
40 (this paragraph not being relevant to the printed manual).
41 @end ignore
42 Permission is granted to copy and distribute modified versions of this
43 manual under the conditions for verbatim copying, provided also that the
44 sections entitled ``Copying'' and ``GNU General Public License'' are
45 included exactly as in the original, and provided that the entire
46 resulting derived work is distributed under the terms of a permission
47 notice identical to this one.
48 @end ifinfo
49
50 @titlepage
51 @title GNU Wget
52 @subtitle The noninteractive downloading utility
53 @subtitle Updated for Wget @value{VERSION}, @value{UPDATED}
54 @author by Hrvoje Nik@v{s}i@'{c}
55
56 @page
57 @vskip 0pt plus 1filll
58 Copyright @copyright{} 1996, 1997, 1998 Free Software Foundation, Inc.
59
60 Permission is granted to make and distribute verbatim copies of this
61 manual provided the copyright notice and this permission notice are
62 preserved on all copies.
63
64 Permission is granted to copy and distribute modified versions of this
65 manual under the conditions for verbatim copying, provided also that the
66 sections entitled ``Copying'' and ``GNU General Public License'' are
67 included exactly as in the original, and provided that the entire
68 resulting derived work is distributed under the terms of a permission
69 notice identical to this one.
70
71 Permission is granted to copy and distribute translations of this manual
72 into another language, under the above conditions for modified versions,
73 except that this permission notice may be stated in a translation
74 approved by the Free Software Foundation.
75 @end titlepage
76
77 @ifinfo
78 @node Top, Overview, (dir), (dir)
79 @top Wget @value{VERSION}
80
81 This manual documents version @value{VERSION} of GNU Wget, the freely
82 available utility for network download.
83
84 Copyright @copyright{} 1996, 1997, 1998 Free Software Foundation, Inc.
85
86 @menu
87 * Overview::            Features of Wget.
88 * Invoking::            Wget command-line arguments.
89 * Recursive Retrieval:: Description of recursive retrieval.
90 * Following Links::     The available methods of chasing links.
91 * Time-Stamping::       Mirroring according to time-stamps.
92 * Startup File::        Wget's initialization file.
93 * Examples::            Examples of usage.
94 * Various::             The stuff that doesn't fit anywhere else.
95 * Appendices::          Some useful references.
96 * Copying::             You may give out copies of Wget.
97 * Concept Index::       Topics covered by this manual.
98 @end menu
99 @end ifinfo
100
101 @node Overview, Invoking, Top, Top
102 @chapter Overview
103 @cindex overview
104 @cindex features
105
106 GNU Wget is a freely available network utility to retrieve files from
107 the World Wide Web, using @sc{http} (Hyper Text Transfer Protocol) and
108 @sc{ftp} (File Transfer Protocol), the two most widely used Internet
109 protocols.  It has many useful features to make downloading easier, some
110 of them being:
111
112 @itemize @bullet
113 @item
114 Wget is non-interactive, meaning that it can work in the background,
115 while the user is not logged on.  This allows you to start a retrieval
116 and disconnect from the system, letting Wget finish the work.  By
117 contrast, most of the Web browsers require constant user's presence,
118 which can be a great hindrance when transferring a lot of data.
119
120 @sp 1
121 @item
122 Wget is capable of descending recursively through the structure of
123 @sc{html} documents and @sc{ftp} directory trees, making a local copy of
124 the directory hierarchy similar to the one on the remote server.  This
125 feature can be used to mirror archives and home pages, or traverse the
126 web in search of data, like a @sc{www} robot (@xref{Robots}).  In that
127 spirit, Wget understands the @code{norobots} convention.
128
129 @sp 1
130 @item
131 File name wildcard matching and recursive mirroring of directories are
132 available when retrieving via @sc{ftp}.  Wget can read the time-stamp
133 information given by both @sc{http} and @sc{ftp} servers, and store it
134 locally.  Thus Wget can see if the remote file has changed since last
135 retrieval, and automatically retrieve the new version if it has.  This
136 makes Wget suitable for mirroring of @sc{ftp} sites, as well as home
137 pages.
138
139 @sp 1
140 @item
141 Wget works exceedingly well on slow or unstable connections, 
142 retrying the document until it is fully retrieved, or until a
143 user-specified retry count is surpassed.  It will try to resume the
144 download from the point of interruption, using @code{REST} with @sc{ftp}
145 and @code{Range} with @sc{http} servers that support them.
146
147 @sp 1
148 @item
149 By default, Wget supports proxy servers, which can lighten the network
150 load, speed up retrieval and provide access behind firewalls.  However,
151 if you are behind a firewall that requires that you use a socks style
152 gateway, you can get the socks library and build wget with support for
153 socks.  Wget also supports the passive @sc{ftp} downloading as an
154 option.
155
156 @sp 1
157 @item
158 Builtin features offer mechanisms to tune which links you wish to follow
159 (@xref{Following Links}).
160
161 @sp 1
162 @item
163 The retrieval is conveniently traced with printing dots, each dot
164 representing a fixed amount of data received (1KB by default).  These
165 representations can be customized to your preferences.
166
167 @sp 1
168 @item
169 Most of the features are fully configurable, either through command line
170 options, or via the initialization file @file{.wgetrc} (@xref{Startup
171 File}).  Wget allows you to define @dfn{global} startup files
172 (@file{/usr/local/etc/wgetrc} by default) for site settings.
173
174 @sp 1
175 @item
176 Finally, GNU Wget is free software.  This means that everyone may use
177 it, redistribute it and/or modify it under the terms of the GNU General
178 Public License, as published by the Free Software Foundation
179 (@xref{Copying}).
180 @end itemize
181
182 @node Invoking, Recursive Retrieval, Overview, Top
183 @chapter Invoking
184 @cindex invoking
185 @cindex command line
186 @cindex arguments
187 @cindex nohup
188
189 By default, Wget is very simple to invoke.  The basic syntax is:
190
191 @example
192 wget [@var{option}]@dots{} [@var{URL}]@dots{}
193 @end example
194
195 Wget will simply download all the @sc{url}s specified on the command
196 line.  @var{URL} is a @dfn{Uniform Resource Locator}, as defined below.
197
198 However, you may wish to change some of the default parameters of
199 Wget.  You can do it two ways: permanently, adding the appropriate
200 command to @file{.wgetrc} (@xref{Startup File}), or specifying it on
201 the command line.
202
203 @menu
204 * URL Format::
205 * Option Syntax::
206 * Basic Startup Options::
207 * Logging and Input File Options::
208 * Download Options::
209 * Directory Options::
210 * HTTP Options::
211 * FTP Options::
212 * Recursive Retrieval Options::
213 * Recursive Accept/Reject Options::
214 @end menu
215
216 @node URL Format, Option Syntax, Invoking, Invoking
217 @section URL Format
218 @cindex URL
219 @cindex URL syntax
220
221 @dfn{URL} is an acronym for Uniform Resource Locator.  A uniform
222 resource locator is a compact string representation for a resource
223 available via the Internet.  Wget recognizes the @sc{url} syntax as per
224 @sc{rfc1738}.  This is the most widely used form (square brackets denote
225 optional parts):
226
227 @example
228 http://host[:port]/directory/file
229 ftp://host[:port]/directory/file
230 @end example
231
232 You can also encode your username and password within a @sc{url}:
233
234 @example
235 ftp://user:password@@host/path
236 http://user:password@@host/path
237 @end example
238
239 Either @var{user} or @var{password}, or both, may be left out.  If you
240 leave out either the @sc{http} username or password, no authentication
241 will be sent.  If you leave out the @sc{ftp} username, @samp{anonymous}
242 will be used.  If you leave out the @sc{ftp} password, your email
243 address will be supplied as a default password.@footnote{If you have a
244 @file{.netrc} file in your home directory, password will also be
245 searched for there.}
246
247 You can encode unsafe characters in a @sc{url} as @samp{%xy}, @code{xy}
248 being the hexadecimal representation of the character's @sc{ascii}
249 value.  Some common unsafe characters include @samp{%} (quoted as
250 @samp{%25}), @samp{:} (quoted as @samp{%3A}), and @samp{@@} (quoted as
251 @samp{%40}).  Refer to @sc{rfc1738} for a comprehensive list of unsafe
252 characters.
253
254 Wget also supports the @code{type} feature for @sc{ftp} @sc{url}s.  By
255 default, @sc{ftp} documents are retrieved in the binary mode (type
256 @samp{i}), which means that they are downloaded unchanged.  Another
257 useful mode is the @samp{a} (@dfn{ASCII}) mode, which converts the line
258 delimiters between the different operating systems, and is thus useful
259 for text files.  Here is an example:
260
261 @example
262 ftp://host/directory/file;type=a
263 @end example
264
265 Two alternative variants of @sc{url} specification are also supported,
266 because of historical (hysterical?) reasons and their wide-spreadedness.
267
268 @sc{ftp}-only syntax (supported by @code{NcFTP}):
269 @example
270 host:/dir/file
271 @end example
272
273 @sc{http}-only syntax (introduced by @code{Netscape}):
274 @example
275 host[:port]/dir/file
276 @end example
277
278 These two alternative forms are deprecated, and may cease being
279 supported in the future.
280
281 If you do not understand the difference between these notations, or do
282 not know which one to use, just use the plain ordinary format you use
283 with your favorite browser, like @code{Lynx} or @code{Netscape}.
284
285 @node Option Syntax, Basic Startup Options, URL Format, Invoking
286 @section Option Syntax
287 @cindex option syntax
288 @cindex syntax of options
289
290 Since Wget uses GNU getopts to process its arguments, every option has a
291 short form and a long form.  Long options are more convenient to
292 remember, but take time to type.  You may freely mix different option
293 styles, or specify options after the command-line arguments. Thus you
294 may write:
295
296 @example
297 wget -r --tries=10 http://fly.cc.fer.hr/ -o log
298 @end example
299
300 The space between the option accepting an argument and the argument may
301 be omitted.  Instead @samp{-o log} you can write @samp{-olog}.
302
303 You may put several options that do not require arguments together,
304 like:
305
306 @example
307 wget -drc @var{URL}
308 @end example
309
310 This is a complete equivalent of:
311
312 @example
313 wget -d -r -c @var{URL}
314 @end example
315
316 Since the options can be specified after the arguments, you may
317 terminate them with @samp{--}.  So the following will try to download
318 @sc{url} @samp{-x}, reporting failure to @file{log}:
319
320 @example
321 wget -o log -- -x
322 @end example
323
324 The options that accept comma-separated lists all respect the convention
325 that specifying an empty list clears its value.  This can be useful to
326 clear the @file{.wgetrc} settings.  For instance, if your @file{.wgetrc}
327 sets @code{exclude_directories} to @file{/cgi-bin}, the following
328 example will first reset it, and then set it to exclude @file{/~nobody}
329 and @file{/~somebody}.  You can also clear the lists in @file{.wgetrc}
330 (@xref{Wgetrc Syntax}).
331
332 @example
333 wget -X '' -X /~nobody,/~somebody
334 @end example
335
336 @node Basic Startup Options, Logging and Input File Options, Option Syntax, Invoking
337 @section Basic Startup Options
338
339 @table @samp
340 @item -V
341 @itemx --version
342 Display the version of Wget.
343
344 @item -h
345 @itemx --help
346 Print a help message describing all of Wget's command-line options.
347
348 @item -b
349 @itemx --background
350 Go to background immediately after startup.  If no output file is
351 specified via the @samp{-o}, output is redirected to @file{wget-log}.
352
353 @cindex execute wgetrc command
354 @item -e @var{command}
355 @itemx --execute @var{command}
356 Execute @var{command} as if it were a part of @file{.wgetrc}
357 (@xref{Startup File}).  A command thus invoked will be executed
358 @emph{after} the commands in @file{.wgetrc}, thus taking precedence over
359 them.
360 @end table
361
362 @node Logging and Input File Options, Download Options, Basic Startup Options, Invoking
363 @section Logging and Input File Options
364
365 @table @samp
366 @cindex output file
367 @cindex log file
368 @item -o @var{logfile}
369 @itemx --output-file=@var{logfile}
370 Log all messages to @var{logfile}.  The messages are normally reported
371 to standard error.
372
373 @cindex append to log
374 @item -a @var{logfile}
375 @itemx --append-output=@var{logfile}
376 Append to @var{logfile}.  This is the same as @samp{-o}, only it appends
377 to @var{logfile} instead of overwriting the old log file.  If
378 @var{logfile} does not exist, a new file is created.
379
380 @cindex debug
381 @item -d
382 @itemx --debug
383 Turn on debug output, meaning various information important to the
384 developers of Wget if it does not work properly.  Your system
385 administrator may have chosen to compile Wget without debug support, in
386 which case @samp{-d} will not work.  Please note that compiling with
387 debug support is always safe---Wget compiled with the debug support will
388 @emph{not} print any debug info unless requested with @samp{-d}.
389 @xref{Reporting Bugs} for more information on how to use @samp{-d} for
390 sending bug reports.
391
392 @cindex quiet
393 @item -q
394 @itemx --quiet
395 Turn off Wget's output.
396
397 @cindex verbose
398 @item -v
399 @itemx --verbose
400 Turn on verbose output, with all the available data.  The default output
401 is verbose.
402
403 @item -nv
404 @itemx --non-verbose
405 Non-verbose output---turn off verbose without being completely quiet
406 (use @samp{-q} for that), which means that error messages and basic
407 information still get printed.
408
409 @cindex input-file
410 @item -i @var{file}
411 @itemx --input-file=@var{file}
412 Read @sc{url}s from @var{file}, in which case no @sc{url}s need to be on
413 the command line.  If there are @sc{url}s both on the command line and
414 in an input file, those on the command lines will be the first ones to
415 be retrieved.  The @var{file} need not be an @sc{html} document (but no
416 harm if it is)---it is enough if the @sc{url}s are just listed
417 sequentially.
418
419 However, if you specify @samp{--force-html}, the document will be
420 regarded as @samp{html}.  In that case you may have problems with
421 relative links, which you can solve either by adding @code{<base
422 href="@var{url}">} to the documents or by specifying
423 @samp{--base=@var{url}} on the command line.
424
425 @cindex force html
426 @item -F
427 @itemx --force-html
428 When input is read from a file, force it to be treated as an @sc{html}
429 file.  This enables you to retrieve relative links from existing
430 @sc{html} files on your local disk, by adding @code{<base
431 href="@var{url}">} to @sc{html}, or using the @samp{--base} command-line
432 option.
433 @end table
434
435 @node Download Options, Directory Options, Logging and Input File Options, Invoking
436 @section Download Options
437
438 @table @samp
439 @cindex retries
440 @cindex tries
441 @cindex number of retries
442 @item -t @var{number}
443 @itemx --tries=@var{number}
444 Set number of retries to @var{number}.  Specify 0 or @samp{inf} for
445 infinite retrying.
446
447 @item -O @var{file}
448 @itemx --output-document=@var{file}
449 The documents will not be written to the appropriate files, but all will
450 be concatenated together and written to @var{file}.  If @var{file}
451 already exists, it will be overwritten.  If the @var{file} is @samp{-},
452 the documents will be written to standard output.  Including this option
453 automatically sets the number of tries to 1.
454
455 @cindex no-clobber
456 @item -nc
457 @itemx --no-clobber
458 Do not clobber existing files when saving to directory hierarchy within
459 recursive retrieval of several files. This option is @emph{extremely}
460 useful when you wish to continue where you left off with retrieval of
461 many files.  If the files have the @samp{.html} or (yuck) @samp{.htm}
462 suffix, they will be loaded from the local disk, and parsed as if they
463 have been retrieved from the Web.
464
465 @cindex continue retrieval
466 @item -c
467 @itemx --continue
468 Continue getting an existing file.  This is useful when you want to
469 finish up the download started by another program, or a previous
470 instance of Wget.  Thus you can write:
471
472 @example
473 wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
474 @end example
475
476 If there is a file name @file{ls-lR.Z} in the current directory, Wget
477 will assume that it is the first portion of the remote file, and will
478 require the server to continue the retrieval from an offset equal to the
479 length of the local file.
480
481 Note that you need not specify this option if all you want is Wget to
482 continue retrieving where it left off when the connection is lost---Wget
483 does this by default.  You need this option only when you want to
484 continue retrieval of a file already halfway retrieved, saved by another
485 @sc{ftp} client, or left by Wget being killed.
486
487 Without @samp{-c}, the previous example would just begin to download the
488 remote file to @file{ls-lR.Z.1}.  The @samp{-c} option is also
489 applicable for @sc{http} servers that support the @code{Range} header.
490
491 @cindex dot style
492 @cindex retrieval tracing style
493 @item --dot-style=@var{style}
494 Set the retrieval style to @var{style}.  Wget traces the retrieval of
495 each document by printing dots on the screen, each dot representing a
496 fixed amount of retrieved data.  Any number of dots may be separated in
497 a @dfn{cluster}, to make counting easier.  This option allows you to
498 choose one of the pre-defined styles, determining the number of bytes
499 represented by a dot, the number of dots in a cluster, and the number of
500 dots on the line.
501
502 With the @code{default} style each dot represents 1K, there are ten dots
503 in a cluster and 50 dots in a line.  The @code{binary} style has a more
504 ``computer''-like orientation---8K dots, 16-dots clusters and 48 dots
505 per line (which makes for 384K lines).  The @code{mega} style is
506 suitable for downloading very large files---each dot represents 64K
507 retrieved, there are eight dots in a cluster, and 48 dots on each line
508 (so each line contains 3M).  The @code{micro} style is exactly the
509 reverse; it is suitable for downloading small files, with 128-byte dots,
510 8 dots per cluster, and 48 dots (6K) per line.
511
512 @item -N
513 @itemx --timestamping
514 Turn on time-stamping.  @xref{Time-Stamping} for details.
515
516 @cindex server response, print
517 @item -S
518 @itemx --server-response
519 Print the headers sent by @sc{http} servers and responses sent by
520 @sc{ftp} servers.
521
522 @cindex Wget as spider
523 @cindex spider
524 @item --spider
525 When invoked with this option, Wget will behave as a Web @dfn{spider},
526 which means that it will not download the pages, just check that they
527 are there.  You can use it to check your bookmarks, e.g. with:
528
529 @example
530 wget --spider --force-html -i bookmarks.html
531 @end example
532
533 This feature needs much more work for Wget to get close to the
534 functionality of real @sc{www} spiders.
535
536 @cindex timeout
537 @item -T seconds
538 @itemx --timeout=@var{seconds}
539 Set the read timeout to @var{seconds} seconds.  Whenever a network read
540 is issued, the file descriptor is checked for a timeout, which could
541 otherwise leave a pending connection (uninterrupted read).  The default
542 timeout is 900 seconds (fifteen minutes).  Setting timeout to 0 will
543 disable checking for timeouts.
544
545 Please do not lower the default timeout value with this option unless
546 you know what you are doing.
547
548 @cindex pause
549 @cindex wait
550 @item -w @var{seconds}
551 @itemx --wait=@var{seconds}
552 Wait the specified number of seconds between the retrievals.  Use of
553 this option is recommended, as it lightens the server load by making the
554 requests less frequent.  Instead of in seconds, the time can be
555 specified in minutes using the @code{m} suffix, in hours using @code{h}
556 suffix, or in days using @code{d} suffix.
557
558 Specifying a large value for this option is useful if the network or the
559 destination host is down, so that Wget can wait long enough to
560 reasonably expect the network error to be fixed before the retry.
561
562 @cindex proxy
563 @item -Y on/off
564 @itemx --proxy=on/off
565 Turn proxy support on or off. The proxy is on by default if the
566 appropriate environmental variable is defined.
567
568 @cindex quota
569 @item -Q @var{quota}
570 @itemx --quota=@var{quota}
571 Specify download quota for automatic retrievals.  The value can be
572 specified in bytes (default), kilobytes (with @samp{k} suffix), or
573 megabytes (with @samp{m} suffix).
574
575 Note that quota will never affect downloading a single file.  So if you
576 specify @samp{wget -Q10k ftp://wuarchive.wustl.edu/ls-lR.gz}, all of the
577 @file{ls-lR.gz} will be downloaded.  The same goes even when several
578 @sc{url}s are specified on the command-line.  However, quota is
579 respected when retrieving either recursively, or from an input file.
580 Thus you may safely type @samp{wget -Q2m -i sites}---download will be
581 aborted when the quota is exceeded.
582
583 Setting quota to 0 or to @samp{inf} unlimits the download quota.
584 @end table
585
586 @node Directory Options, HTTP Options, Download Options, Invoking
587 @section Directory Options
588
589 @table @samp
590 @item -nd
591 @itemx --no-directories
592 Do not create a hierarchy of directories when retrieving
593 recursively. With this option turned on, all files will get saved to the
594 current directory, without clobbering (if a name shows up more than
595 once, the filenames will get extensions @samp{.n}).
596
597 @item -x
598 @itemx --force-directories
599 The opposite of @samp{-nd}---create a hierarchy of directories, even if
600 one would not have been created otherwise.  E.g. @samp{wget -x
601 http://fly.cc.fer.hr/robots.txt} will save the downloaded file to
602 @file{fly.cc.fer.hr/robots.txt}.
603
604 @item -nH
605 @itemx --no-host-directories
606 Disable generation of host-prefixed directories.  By default, invoking
607 Wget with @samp{-r http://fly.cc.fer.hr/} will create a structure of
608 directories beginning with @file{fly.cc.fer.hr/}.  This option disables
609 such behavior.
610
611 @cindex cut directories
612 @item --cut-dirs=@var{number}
613 Ignore @var{number} directory components.  This is useful for getting a
614 fine-grained control over the directory where recursive retrieval will
615 be saved.
616
617 Take, for example, the directory at
618 @samp{ftp://ftp.xemacs.org/pub/xemacs/}.  If you retrieve it with
619 @samp{-r}, it will be saved locally under
620 @file{ftp.xemacs.org/pub/xemacs/}.  While the @samp{-nH} option can
621 remove the @file{ftp.xemacs.org/} part, you are still stuck with
622 @file{pub/xemacs}.  This is where @samp{--cut-dirs} comes in handy; it
623 makes Wget not ``see'' @var{number} remote directory components.  Here
624 are several examples of how @samp{--cut-dirs} option works.
625
626 @example
627 @group
628 No options        -> ftp.xemacs.org/pub/xemacs/
629 -nH               -> pub/xemacs/
630 -nH --cut-dirs=1  -> xemacs/
631 -nH --cut-dirs=2  -> .
632
633 --cut-dirs=1      -> ftp.xemacs.org/xemacs/
634 ...
635 @end group
636 @end example
637
638 If you just want to get rid of the directory structure, this option is
639 similar to a combination of @samp{-nd} and @samp{-P}.  However, unlike
640 @samp{-nd}, @samp{--cut-dirs} does not lose with subdirectories---for
641 instance, with @samp{-nH --cut-dirs=1}, a @file{beta/} subdirectory will
642 be placed to @file{xemacs/beta}, as one would expect.
643
644 @cindex directory prefix
645 @item -P @var{prefix}
646 @itemx --directory-prefix=@var{prefix}
647 Set directory prefix to @var{prefix}.  The @dfn{directory prefix} is the
648 directory where all other files and subdirectories will be saved to,
649 i.e. the top of the retrieval tree.  The default is @samp{.} (the
650 current directory).
651 @end table
652
653 @node HTTP Options, FTP Options, Directory Options, Invoking
654 @section HTTP Options
655
656 @table @samp
657 @cindex http user
658 @cindex http password
659 @cindex authentication
660 @item --http-user=@var{user}
661 @itemx --http-passwd=@var{password}
662 Specify the username @var{user} and password @var{password} on an
663 @sc{http} server.  According to the type of the challenge, Wget will
664 encode them using either the @code{basic} (insecure) or the
665 @code{digest} authentication scheme.
666
667 Another way to specify username and password is in the @sc{url} itself
668 (@xref{URL Format}).  For more information about security issues with
669 Wget, @xref{Security Considerations}.
670
671 @cindex proxy
672 @cindex cache
673 @item -C on/off
674 @itemx --cache=on/off
675 When set to off, disable server-side cache.  In this case, Wget will
676 send the remote server an appropriate directive (@samp{Pragma:
677 no-cache}) to get the file from the remote service, rather than
678 returning the cached version.  This is especially useful for retrieving
679 and flushing out-of-date documents on proxy servers.
680
681 Caching is allowed by default.
682
683 @cindex Content-Length, ignore
684 @cindex ignore length
685 @item --ignore-length
686 Unfortunately, some @sc{http} servers (@sc{cgi} programs, to be more
687 precise) send out bogus @code{Content-Length} headers, which makes Wget
688 go wild, as it thinks not all the document was retrieved.  You can spot
689 this syndrome if Wget retries getting the same document again and again,
690 each time claiming that the (otherwise normal) connection has closed on
691 the very same byte.
692
693 With this option, Wget will ignore the @code{Content-Length} header---as
694 if it never existed.
695
696 @cindex header, add
697 @item --header=@var{additional-header}
698 Define an @var{additional-header} to be passed to the @sc{http} servers.
699 Headers must contain a @samp{:} preceded by one or more non-blank
700 characters, and must not contain newlines.
701
702 You may define more than one additional header by specifying
703 @samp{--header} more than once.
704
705 @example
706 @group
707 wget --header='Accept-Charset: iso-8859-2' \
708      --header='Accept-Language: hr'        \
709        http://fly.cc.fer.hr/
710 @end group
711 @end example
712
713 Specification of an empty string as the header value will clear all
714 previous user-defined headers.
715
716 @cindex proxy user
717 @cindex proxy password
718 @cindex proxy authentication
719 @item --proxy-user=@var{user}
720 @itemx --proxy-passwd=@var{password}
721 Specify the username @var{user} and password @var{password} for
722 authentication on a proxy server.  Wget will encode them using the
723 @code{basic} authentication scheme.
724
725 @cindex server response, save
726 @item -s
727 @itemx --save-headers
728 Save the headers sent by the @sc{http} server to the file, preceding the
729 actual contents, with an empty line as the separator.
730
731 @cindex user-agent
732 @item -U @var{agent-string}
733 @itemx --user-agent=@var{agent-string}
734 Identify as @var{agent-string} to the @sc{http} server.
735
736 The @sc{http} protocol allows the clients to identify themselves using a
737 @code{User-Agent} header field.  This enables distinguishing the
738 @sc{www} software, usually for statistical purposes or for tracing of
739 protocol violations.  Wget normally identifies as
740 @samp{Wget/@var{version}}, @var{version} being the current version
741 number of Wget.
742
743 However, some sites have been known to impose the policy of tailoring
744 the output according to the @code{User-Agent}-supplied information.
745 While conceptually this is not such a bad idea, it has been abused by
746 servers denying information to clients other than @code{Mozilla} or
747 Microsoft @code{Internet Explorer}.  This option allows you to change
748 the @code{User-Agent} line issued by Wget.  Use of this option is
749 discouraged, unless you really know what you are doing.
750
751 @strong{NOTE} that Netscape Communications Corp. has claimed that false
752 transmissions of @samp{Mozilla} as the @code{User-Agent} are a copyright
753 infringement, which will be prosecuted.  @strong{DO NOT} misrepresent
754 Wget as Mozilla.
755 @end table
756
757 @node FTP Options, Recursive Retrieval Options, HTTP Options, Invoking
758 @section FTP Options
759
760 @table @samp
761 @cindex retrieve symbolic links
762 @item --retr-symlinks
763 Retrieve symbolic links on @sc{ftp} sites as if they were plain files,
764 i.e. don't just create links locally.
765
766 @cindex globbing, toggle
767 @item -g on/off
768 @itemx --glob=on/off
769 Turn @sc{ftp} globbing on or off.  Globbing means you may use the
770 shell-like special characters (@dfn{wildcards}), like @samp{*},
771 @samp{?}, @samp{[} and @samp{]} to retrieve more than one file from the
772 same directory at once, like:
773
774 @example
775 wget ftp://gnjilux.cc.fer.hr/*.msg
776 @end example
777
778 By default, globbing will be turned on if the @sc{url} contains a
779 globbing character.  This option may be used to turn globbing on or off
780 permanently.
781
782 You may have to quote the @sc{url} to protect it from being expanded by
783 your shell.  Globbing makes Wget look for a directory listing, which is
784 system-specific.  This is why it currently works only with Unix @sc{ftp}
785 servers (and the ones emulating Unix @code{ls} output).
786
787 @cindex passive ftp
788 @item --passive-ftp
789 Use the @dfn{passive} @sc{ftp} retrieval scheme, in which the client
790 initiates the data connection.  This is sometimes required for @sc{ftp}
791 to work behind firewalls.
792 @end table
793
794 @node Recursive Retrieval Options, Recursive Accept/Reject Options, FTP Options, Invoking
795 @section Recursive Retrieval Options
796
797 @table @samp
798 @item -r
799 @itemx --recursive
800 Turn on recursive retrieving.  @xref{Recursive Retrieval} for more
801 details.
802
803 @item -l @var{depth}
804 @itemx --level=@var{depth}
805 Specify recursion maximum depth level @var{depth} (@xref{Recursive
806 Retrieval}).  The default maximum depth is 5.
807
808 @cindex proxy filling
809 @cindex delete after retrieval
810 @cindex filling proxy cache
811 @item --delete-after
812 This option tells Wget to delete every single file it downloads,
813 @emph{after} having done so.  It is useful for pre-fetching popular
814 pages through proxy, e.g.:
815
816 @example
817 wget -r -nd --delete-after http://whatever.com/~popular/page/
818 @end example
819
820 The @samp{-r} option is to retrieve recursively, and @samp{-nd} not to
821 create directories.
822
823 @cindex conversion of links
824 @cindex links conversion
825 @item -k
826 @itemx --convert-links
827 Convert the non-relative links to relative ones locally.  Only the
828 references to the documents actually downloaded will be converted; the
829 rest will be left unchanged.
830
831 Note that only at the end of the download can Wget know which links have
832 been downloaded.  Because of that, much of the work done by @samp{-k}
833 will be performed at the end of the downloads.
834
835 @item -m
836 @itemx --mirror
837 Turn on options suitable for mirroring.  This option turns on recursion
838 and time-stamping, sets infinite recursion depth and keeps @sc{ftp}
839 directory listings.  It is currently equivalent to
840 @samp{-r -N -l inf -nr}.
841
842 @item -nr
843 @itemx --dont-remove-listing
844 Don't remove the temporary @file{.listing} files generated by @sc{ftp}
845 retrievals.  Normally, these files contain the raw directory listings
846 received from @sc{ftp} servers.  Not removing them can be useful to
847 access the full remote file list when running a mirror, or for debugging
848 purposes.
849 @end table
850
851 @node Recursive Accept/Reject Options,  , Recursive Retrieval Options, Invoking
852 @section Recursive Accept/Reject Options
853
854 @table @samp
855 @item -A @var{acclist} --accept @var{acclist}
856 @itemx -R @var{rejlist} --reject @var{rejlist}
857 Specify comma-separated lists of file name suffixes or patterns to
858 accept or reject (@xref{Types of Files} for more details).
859
860 @item -D @var{domain-list}
861 @itemx --domains=@var{domain-list}
862 Set domains to be accepted and @sc{dns} looked-up, where
863 @var{domain-list} is a comma-separated list.  Note that it does
864 @emph{not} turn on @samp{-H}.  This option speeds things up, even if
865 only one host is spanned (@xref{Domain Acceptance}).
866
867 @item --exclude-domains @var{domain-list}
868 Exclude the domains given in a comma-separated @var{domain-list} from
869 @sc{dns}-lookup (@xref{Domain Acceptance}).
870
871 @item -L
872 @itemx --relative
873 Follow relative links only.  Useful for retrieving a specific home page
874 without any distractions, not even those from the same hosts
875 (@xref{Relative Links}).
876
877 @cindex follow FTP links
878 @item --follow-ftp
879 Follow @sc{ftp} links from @sc{html} documents.  Without this option,
880 Wget will ignore all the @sc{ftp} links.
881
882 @item -H
883 @itemx --span-hosts
884 Enable spanning across hosts when doing recursive retrieving (@xref{All
885 Hosts}).
886
887 @item -I @var{list}
888 @itemx --include-directories=@var{list}
889 Specify a comma-separated list of directories you wish to follow when
890 downloading (@xref{Directory-Based Limits} for more details.)  Elements
891 of @var{list} may contain wildcards.
892
893 @item -X @var{list}
894 @itemx --exclude-directories=@var{list}
895 Specify a comma-separated list of directories you wish to exclude from
896 download (@xref{Directory-Based Limits} for more details.)  Elements of
897 @var{list} may contain wildcards.
898
899 @item -nh
900 @itemx --no-host-lookup
901 Disable the time-consuming @sc{dns} lookup of almost all hosts
902 (@xref{Host Checking}).
903
904 @item -np
905 @item --no-parent
906 Do not ever ascend to the parent directory when retrieving recursively.
907 This is a useful option, since it guarantees that only the files
908 @emph{below} a certain hierarchy will be downloaded.
909 @xref{Directory-Based Limits} for more details.
910 @end table
911
912 @node Recursive Retrieval, Following Links, Invoking, Top
913 @chapter Recursive Retrieval
914 @cindex recursion
915 @cindex retrieving
916 @cindex recursive retrieval
917
918 GNU Wget is capable of traversing parts of the Web (or a single
919 @sc{http} or @sc{ftp} server), depth-first following links and directory
920 structure.  This is called @dfn{recursive} retrieving, or
921 @dfn{recursion}.
922
923 With @sc{http} @sc{url}s, Wget retrieves and parses the @sc{html} from
924 the given @sc{url}, documents, retrieving the files the @sc{html}
925 document was referring to, through markups like @code{href}, or
926 @code{src}.  If the freshly downloaded file is also of type
927 @code{text/html}, it will be parsed and followed further.
928
929 The maximum @dfn{depth} to which the retrieval may descend is specified
930 with the @samp{-l} option (the default maximum depth is five layers).
931 @xref{Recursive Retrieval}.
932
933 When retrieving an @sc{ftp} @sc{url} recursively, Wget will retrieve all
934 the data from the given directory tree (including the subdirectories up
935 to the specified depth) on the remote server, creating its mirror image
936 locally.  @sc{ftp} retrieval is also limited by the @code{depth}
937 parameter.
938
939 By default, Wget will create a local directory tree, corresponding to
940 the one found on the remote server.
941
942 Recursive retrieving can find a number of applications, the most
943 important of which is mirroring.  It is also useful for @sc{www}
944 presentations, and any other opportunities where slow network
945 connections should be bypassed by storing the files locally.
946
947 You should be warned that invoking recursion may cause grave overloading
948 on your system, because of the fast exchange of data through the
949 network; all of this may hamper other users' work.  The same stands for
950 the foreign server you are mirroring---the more requests it gets in a
951 rows, the greater is its load.
952
953 Careless retrieving can also fill your file system unctrollably, which
954 can grind the machine to a halt.
955
956 The load can be minimized by lowering the maximum recursion level
957 (@samp{-l}) and/or by lowering the number of retries (@samp{-t}).  You
958 may also consider using the @samp{-w} option to slow down your requests
959 to the remote servers, as well as the numerous options to narrow the
960 number of followed links (@xref{Following Links}).
961
962 Recursive retrieval is a good thing when used properly.  Please take all
963 precautions not to wreak havoc through carelessness.
964
965 @node Following Links, Time-Stamping, Recursive Retrieval, Top
966 @chapter Following Links
967 @cindex links
968 @cindex following links
969
970 When retrieving recursively, one does not wish to retrieve the loads of
971 unnecessary data.  Most of the time the users bear in mind exactly what
972 they want to download, and want Wget to follow only specific links.
973
974 For example, if you wish to download the music archive from
975 @samp{fly.cc.fer.hr}, you will not want to download all the home pages
976 that happen to be referenced by an obscure part of the archive.
977
978 Wget possesses several mechanisms that allows you to fine-tune which
979 links it will follow.
980
981 @menu
982 * Relative Links::         Follow relative links only.
983 * Host Checking::          Follow links on the same host.
984 * Domain Acceptance::      Check on a list of domains.
985 * All Hosts::              No host restrictions.
986 * Types of Files::         Getting only certain files.
987 * Directory-Based Limits:: Getting only certain directories.
988 * FTP Links::              Following FTP links.
989 @end menu
990
991 @node Relative Links, Host Checking, Following Links, Following Links
992 @section Relative Links
993 @cindex relative links
994
995 When only relative links are followed (option @samp{-L}), recursive
996 retrieving will never span hosts.  No time-expensive @sc{dns}-lookups
997 will be performed, and the process will be very fast, with the minimum
998 strain of the network.  This will suit your needs often, especially when
999 mirroring the output of various @code{x2html} converters, since they
1000 generally output relative links.
1001
1002 @node Host Checking, Domain Acceptance, Relative Links, Following Links
1003 @section Host Checking
1004 @cindex DNS lookup
1005 @cindex host lookup
1006 @cindex host checking
1007
1008 The drawback of following the relative links solely is that humans often
1009 tend to mix them with absolute links to the very same host, and the very
1010 same page.  In this mode (which is the default mode for following links)
1011 all @sc{url}s the that refer to the same host will be retrieved.
1012
1013 The problem with this option are the aliases of the hosts and domains.
1014 Thus there is no way for Wget to know that @samp{regoc.srce.hr} and
1015 @samp{www.srce.hr} are the same host, or that @samp{fly.cc.fer.hr} is
1016 the same as @samp{fly.cc.etf.hr}.  Whenever an absolute link is
1017 encountered, the host is @sc{dns}-looked-up with @code{gethostbyname} to
1018 check whether we are maybe dealing with the same hosts.  Although the
1019 results of @code{gethostbyname} are cached, it is still a great
1020 slowdown, e.g. when dealing with large indices of home pages on different
1021 hosts (because each of the hosts must be and @sc{dns}-resolved to see
1022 whether it just @emph{might} an alias of the starting host).
1023
1024 To avoid the overhead you may use @samp{-nh}, which will turn off
1025 @sc{dns}-resolving and make Wget compare hosts literally.  This will
1026 make things run much faster, but also much less reliable
1027 (e.g. @samp{www.srce.hr} and @samp{regoc.srce.hr} will be flagged as
1028 different hosts).
1029
1030 Note that modern @sc{http} servers allows one IP address to host several
1031 @dfn{virtual servers}, each having its own directory hieratchy.  Such
1032 ``servers'' are distinguished by their hostnames (all of which point to
1033 the same IP address); for this to work, a client must send a @code{Host}
1034 header, which is what Wget does.  However, in that case Wget @emph{must
1035 not} try to divine a host's ``real'' address, nor try to use the same
1036 hostname for each access, i.e. @samp{-nh} must be turned on.
1037
1038 In other words, the @samp{-nh} option must be used to enabling the
1039 retrieval from virtual servers distinguished by their hostnames.  As the
1040 number of such server setups grow, the behavior of @samp{-nh} may become
1041 the default in the future.
1042
1043 @node Domain Acceptance, All Hosts, Host Checking, Following Links
1044 @section Domain Acceptance
1045
1046 With the @samp{-D} option you may specify the domains that will be
1047 followed.  The hosts the domain of which is not in this list will not be
1048 @sc{dns}-resolved.  Thus you can specify @samp{-Dmit.edu} just to make
1049 sure that @strong{nothing outside of @sc{mit} gets looked up}.  This is
1050 very important and useful.  It also means that @samp{-D} does @emph{not}
1051 imply @samp{-H} (span all hosts), which must be specified explicitly.
1052 Feel free to use this options since it will speed things up, with almost
1053 all the reliability of checking for all hosts.  Thus you could invoke
1054
1055 @example
1056 wget -r -D.hr http://fly.cc.fer.hr/
1057 @end example
1058
1059 to make sure that only the hosts in @samp{.hr} domain get
1060 @sc{dns}-looked-up for being equal to @samp{fly.cc.fer.hr}.  So
1061 @samp{fly.cc.etf.hr} will be checked (only once!) and found equal, but
1062 @samp{www.gnu.ai.mit.edu} will not even be checked.
1063
1064 Of course, domain acceptance can be used to limit the retrieval to
1065 particular domains with spanning of hosts in them, but then you must
1066 specify @samp{-H} explicitly.  E.g.:
1067
1068 @example
1069 wget -r -H -Dmit.edu,stanford.edu http://www.mit.edu/
1070 @end example
1071
1072 will start with @samp{http://www.mit.edu/}, following links across
1073 @sc{mit} and Stanford.
1074
1075 If there are domains you want to exclude specifically, you can do it
1076 with @samp{--exclude-domains}, which accepts the same type of arguments
1077 of @samp{-D}, but will @emph{exclude} all the listed domains.  For
1078 example, if you want to download all the hosts from @samp{foo.edu}
1079 domain, with the exception of @samp{sunsite.foo.edu}, you can do it like
1080 this:
1081
1082 @example
1083 wget -rH -Dfoo.edu --exclude-domains sunsite.foo.edu http://www.foo.edu/
1084 @end example
1085
1086 @node All Hosts, Types of Files, Domain Acceptance, Following Links
1087 @section All Hosts
1088 @cindex all hosts
1089 @cindex span hosts
1090
1091 When @samp{-H} is specified without @samp{-D}, all hosts are freely
1092 spanned.  There are no restrictions whatsoever as to what part of the
1093 net Wget will go to fetch documents, other than maximum retrieval depth.
1094 If a page references @samp{www.yahoo.com}, so be it.  Such an option is
1095 rarely useful for itself.
1096
1097 @node Types of Files, Directory-Based Limits, All Hosts, Following Links
1098 @section Types of Files
1099 @cindex types of files
1100
1101 When downloading material from the web, you will often want to restrict
1102 the retrieval to only certain file types.  For example, if you are
1103 interested in downloading @sc{gifs}, you will not be overjoyed to get
1104 loads of Postscript documents, and vice versa.
1105
1106 Wget offers two options to deal with this problem.  Each option
1107 description lists a short name, a long name, and the equivalent command
1108 in @file{.wgetrc}.
1109
1110 @cindex accept wildcards
1111 @cindex accept suffixes
1112 @cindex wildcards, accept
1113 @cindex suffixes, accept
1114 @table @samp
1115 @item -A @var{acclist}
1116 @itemx --accept @var{acclist}
1117 @itemx accept = @var{acclist}
1118 The argument to @samp{--accept} option is a list of file suffixes or
1119 patterns that Wget will download during recursive retrieval.  A suffix
1120 is the ending part of a file, and consists of ``normal'' letters,
1121 e.g. @samp{gif} or @samp{.jpg}.  A matching pattern contains shell-like
1122 wildcards, e.g. @samp{books*} or @samp{zelazny*196[0-9]*}.
1123
1124 So, specifying @samp{wget -A gif,jpg} will make Wget download only the
1125 files ending with @samp{gif} or @samp{jpg}, i.e. @sc{gif}s and
1126 @sc{jpeg}s.  On the other hand, @samp{wget -A "zelazny*196[0-9]*"} will
1127 download only files beginning with @samp{zelazny} and containing numbers
1128 from 1960 to 1969 anywhere within.  Look up the manual of your shell for
1129 a description of how pattern matching works.
1130
1131 Of course, any number of suffixes and patterns can be combined into a
1132 comma-separated list, and given as an argument to @samp{-A}.
1133
1134 @cindex reject wildcards
1135 @cindex reject suffixes
1136 @cindex wildcards, reject
1137 @cindex suffixes, reject
1138 @item -R @var{rejlist}
1139 @itemx --reject @var{rejlist}
1140 @itemx reject = @var{rejlist}
1141 The @samp{--reject} option works the same way as @samp{--accept}, only
1142 its logic is the reverse; Wget will download all files @emph{except} the
1143 ones matching the suffixes (or patterns) in the list.
1144
1145 So, if you want to download a whole page except for the cumbersome
1146 @sc{mpeg}s and @sc{.au} files, you can use @samp{wget -R mpg,mpeg,au}.
1147 Analogously, to download all files except the ones beginning with
1148 @samp{bjork}, use @samp{wget -R "bjork*"}.  The quotes are to prevent
1149 expansion by the shell.
1150 @end table
1151
1152 The @samp{-A} and @samp{-R} options may be combined to achieve even
1153 better fine-tuning of which files to retrieve.  E.g. @samp{wget -A
1154 "*zelazny*" -R .ps} will download all the files having @samp{zelazny} as
1155 a part of their name, but @emph{not} the postscript files.
1156
1157 Note that these two options do not affect the downloading of @sc{html}
1158 files; Wget must load all the @sc{html}s to know where to go at
1159 all---recursive retrieval would make no sense otherwise.
1160
1161 @node Directory-Based Limits, FTP Links, Types of Files, Following Links
1162 @section Directory-Based Limits
1163 @cindex directories
1164 @cindex directory limits
1165
1166 Regardless of other link-following facilities, it is often useful to
1167 place the restriction of what files to retrieve based on the directories
1168 those files are placed in.  There can be many reasons for this---the
1169 home pages may be organized in a reasonable directory structure; or some
1170 directories may contain useless information, e.g. @file{/cgi-bin} or
1171 @file{/dev} directories.
1172
1173 Wget offers three different options to deal with this requirement.  Each
1174 option description lists a short name, a long name, and the equivalent
1175 command in @file{.wgetrc}.
1176
1177 @cindex directories, include
1178 @cindex include directories
1179 @cindex accept directories
1180 @table @samp
1181 @item -I @var{list}
1182 @itemx --include @var{list}
1183 @itemx include_directories = @var{list}
1184 @samp{-I} option accepts a comma-separated list of directories included
1185 in the retrieval.  Any other directories will simply be ignored.  The
1186 directories are absolute paths.
1187
1188 So, if you wish to download from @samp{http://host/people/bozo/}
1189 following only links to bozo's colleagues in the @file{/people}
1190 directory and the bogus scripts in @file{/cgi-bin}, you can specify:
1191
1192 @example
1193 wget -I /people,/cgi-bin http://host/people/bozo/
1194 @end example
1195
1196 @cindex directories, exclude
1197 @cindex exclude directories
1198 @cindex reject directories
1199 @item -X @var{list}
1200 @itemx --exclude @var{list}
1201 @itemx exclude_directories = @var{list}
1202 @samp{-X} option is exactly the reverse of @samp{-I}---this is a list of
1203 directories @emph{excluded} from the download.  E.g. if you do not want
1204 Wget to download things from @file{/cgi-bin} directory, specify @samp{-X
1205 /cgi-bin} on the command line.
1206
1207 The same as with @samp{-A}/@samp{-R}, these two options can be combined
1208 to get a better fine-tuning of downloading subdirectories.  E.g. if you
1209 want to load all the files from @file{/pub} hierarchy except for
1210 @file{/pub/worthless}, specify @samp{-I/pub -X/pub/worthless}.
1211
1212 @cindex no parent
1213 @item -np
1214 @itemx --no-parent
1215 @itemx no_parent = on
1216 The simplest, and often very useful way of limiting directories is
1217 disallowing retrieval of the links that refer to the hierarchy
1218 @dfn{upper} than the beginning directory, i.e. disallowing ascent to the
1219 parent directory/directories.
1220
1221 The @samp{--no-parent} option (short @samp{-np}) is useful in this case.
1222 Using it guarantees that you will never leave the existing hierarchy.
1223 Supposing you issue Wget with:
1224
1225 @example
1226 wget -r --no-parent http://somehost/~luzer/my-archive/
1227 @end example
1228
1229 You may rest assured that none of the references to
1230 @file{/~his-girls-homepage/} or @file{/~luzer/all-my-mpegs/} will be
1231 followed.  Only the archive you are interested in will be downloaded.
1232 Essentially, @samp{--no-parent} is similar to
1233 @samp{-I/~luzer/my-archive}, only it handles redirections in a more
1234 intelligent fashion.
1235 @end table
1236
1237 @node FTP Links,  , Directory-Based Limits, Following Links
1238 @section Following FTP Links
1239 @cindex following ftp links
1240
1241 The rules for @sc{ftp} are somewhat specific, as it is necessary for
1242 them to be.  @sc{ftp} links in @sc{html} documents are often included
1243 for purposes of reference, and it is often inconvenient to download them
1244 by default.
1245
1246 To have @sc{ftp} links followed from @sc{html} documents, you need to
1247 specify the @samp{--follow-ftp} option.  Having done that, @sc{ftp}
1248 links will span hosts regardless of @samp{-H} setting.  This is logical,
1249 as @sc{ftp} links rarely point to the same host where the @sc{http}
1250 server resides.  For similar reasons, the @samp{-L} options has no
1251 effect on such downloads.  On the other hand, domain acceptance
1252 (@samp{-D}) and suffix rules (@samp{-A} and @samp{-R}) apply normally.
1253
1254 Also note that followed links to @sc{ftp} directories will not be
1255 retrieved recursively further.
1256
1257 @node Time-Stamping, Startup File, Following Links, Top
1258 @chapter Time-Stamping
1259 @cindex time-stamping
1260 @cindex timestamping
1261 @cindex updating the archives
1262 @cindex incremental updating
1263
1264 One of the most important aspects of mirroring information from the
1265 Internet is updating your archives.
1266
1267 Downloading the whole archive again and again, just to replace a few
1268 changed files is expensive, both in terms of wasted bandwidth and money,
1269 and the time to do the update.  This is why all the mirroring tools
1270 offer the option of incremental updating.
1271
1272 Such an updating mechanism means that the remote server is scanned in
1273 search of @dfn{new} files.  Only those new files will be downloaded in
1274 the place of the old ones.
1275
1276 A file is considered new if one of these two conditions are met:
1277
1278 @enumerate
1279 @item
1280 A file of that name does not already exist locally.
1281
1282 @item
1283 A file of that name does exist, but the remote file was modified more
1284 recently than the local file.
1285 @end enumerate
1286
1287 To implement this, the program needs to be aware of the time of last
1288 modification of both remote and local files.  Such information are
1289 called the @dfn{time-stamps}.
1290
1291 The time-stamping in GNU Wget is turned on using @samp{--timestamping}
1292 (@samp{-N}) option, or through @code{timestamping = on} directive in
1293 @file{.wgetrc}.  With this option, for each file it intends to download,
1294 Wget will check whether a local file of the same name exists.  If it
1295 does, and the remote file is older, Wget will not download it.
1296
1297 If the local file does not exist, or the sizes of the files do not
1298 match, Wget will download the remote file no matter what the time-stamps
1299 say.
1300
1301 @menu
1302 * Time-Stamping Usage::
1303 * HTTP Time-Stamping Internals::
1304 * FTP Time-Stamping Internals::
1305 @end menu
1306
1307 @node Time-Stamping Usage, HTTP Time-Stamping Internals, Time-Stamping, Time-Stamping
1308 @section Time-Stamping Usage
1309 @cindex time-stamping usage
1310 @cindex usage, time-stamping
1311
1312 The usage of time-stamping is simple.  Say you would like to download a
1313 file so that it keeps its date of modification.
1314
1315 @example
1316 wget -S http://www.gnu.ai.mit.edu/
1317 @end example
1318
1319 A simple @code{ls -l} shows that the time stamp on the local file equals
1320 the state of the @code{Last-Modified} header, as returned by the server.
1321 As you can see, the time-stamping info is preserved locally, even
1322 without @samp{-N}.
1323
1324 Several days later, you would like Wget to check if the remote file has
1325 changed, and download it if it has.
1326
1327 @example
1328 wget -N http://www.gnu.ai.mit.edu/
1329 @end example
1330
1331 Wget will ask the server for the last-modified date.  If the local file
1332 is newer, the remote file will not be re-fetched.  However, if the remote
1333 file is more recent, Wget will proceed fetching it normally.
1334
1335 The same goes for @sc{ftp}.  For example:
1336
1337 @example
1338 wget ftp://ftp.ifi.uio.no/pub/emacs/gnus/*
1339 @end example
1340
1341 @code{ls} will show that the timestamps are set according to the state
1342 on the remote server.  Reissuing the command with @samp{-N} will make
1343 Wget re-fetch @emph{only} the files that have been modified.
1344
1345 In both @sc{http} and @sc{ftp} retrieval Wget will time-stamp the local
1346 file correctly (with or without @samp{-N}) if it gets the stamps,
1347 i.e. gets the directory listing for @sc{ftp} or the @code{Last-Modified}
1348 header for @sc{http}.
1349
1350 If you wished to mirror the GNU archive every week, you would use the
1351 following command every week:
1352
1353 @example
1354 wget --timestamping -r ftp://prep.ai.mit.edu/pub/gnu/
1355 @end example
1356
1357 @node HTTP Time-Stamping Internals, FTP Time-Stamping Internals, Time-Stamping Usage, Time-Stamping
1358 @section HTTP Time-Stamping Internals
1359 @cindex http time-stamping
1360
1361 Time-stamping in @sc{http} is implemented by checking of the
1362 @code{Last-Modified} header.  If you wish to retrieve the file
1363 @file{foo.html} through @sc{http}, Wget will check whether
1364 @file{foo.html} exists locally.  If it doesn't, @file{foo.html} will be
1365 retrieved unconditionally.
1366
1367 If the file does exist locally, Wget will first check its local
1368 time-stamp (similar to the way @code{ls -l} checks it), and then send a
1369 @code{HEAD} request to the remote server, demanding the information on
1370 the remote file.
1371
1372 The @code{Last-Modified} header is examined to find which file was
1373 modified more recently (which makes it ``newer'').  If the remote file
1374 is newer, it will be downloaded; if it is older, Wget will give
1375 up.@footnote{As an additional check, Wget will look at the
1376 @code{Content-Length} header, and compare the sizes; if they are not the
1377 same, the remote file will be downloaded no matter what the time-stamp
1378 says.}
1379
1380 Arguably, @sc{http} time-stamping should be implemented using the
1381 @code{If-Modified-Since} request.
1382
1383 @node FTP Time-Stamping Internals,  , HTTP Time-Stamping Internals, Time-Stamping
1384 @section FTP Time-Stamping Internals
1385 @cindex ftp time-stamping
1386
1387 In theory, @sc{ftp} time-stamping works much the same as @sc{http}, only
1388 @sc{ftp} has no headers---time-stamps must be received from the
1389 directory listings.
1390
1391 For each directory files must be retrieved from, Wget will use the
1392 @code{LIST} command to get the listing.  It will try to analyze the
1393 listing, assuming that it is a Unix @code{ls -l} listing, and extract
1394 the time-stamps.  The rest is exactly the same as for @sc{http}.
1395
1396 Assumption that every directory listing is a Unix-style listing may
1397 sound extremely constraining, but in practice it is not, as many
1398 non-Unix @sc{ftp} servers use the Unixoid listing format because most
1399 (all?) of the clients understand it.  Bear in mind that @sc{rfc959}
1400 defines no standard way to get a file list, let alone the time-stamps.
1401 We can only hope that a future standard will define this.
1402
1403 Another non-standard solution includes the use of @code{MDTM} command
1404 that is supported by some @sc{ftp} servers (including the popular
1405 @code{wu-ftpd}), which returns the exact time of the specified file.
1406 Wget may support this command in the future.
1407
1408 @node Startup File, Examples, Time-Stamping, Top
1409 @chapter Startup File
1410 @cindex startup file
1411 @cindex wgetrc
1412 @cindex .wgetrc
1413 @cindex startup
1414 @cindex .netrc
1415
1416 Once you know how to change default settings of Wget through command
1417 line arguments, you may wish to make some of those settings permanent.
1418 You can do that in a convenient way by creating the Wget startup
1419 file---@file{.wgetrc}.
1420
1421 Besides @file{.wgetrc} is the ``main'' initialization file, it is
1422 convenient to have a special facility for storing passwords.  Thus Wget
1423 reads and interprets the contents of @file{$HOME/.netrc}, if it finds
1424 it.  You can find @file{.netrc} format in your system manuals.
1425
1426 Wget reads @file{.wgetrc} upon startup, recognizing a limited set of
1427 commands.
1428
1429 @menu
1430 * Wgetrc Location::   Location of various wgetrc files.
1431 * Wgetrc Syntax::     Syntax of wgetrc.
1432 * Wgetrc Commands::   List of available commands.
1433 * Sample Wgetrc::     A wgetrc example.
1434 @end menu
1435
1436 @node Wgetrc Location, Wgetrc Syntax, Startup File, Startup File
1437 @section Wgetrc Location
1438 @cindex wgetrc location
1439 @cindex location of wgetrc
1440
1441 When initializing, Wget will look for a @dfn{global} startup file,
1442 @file{/usr/local/etc/wgetrc} by default (or some prefix other than
1443 @file{/usr/local}, if Wget was not installed there) and read commands
1444 from there, if it exists.
1445
1446 Then it will look for the user's file.  If the environmental variable
1447 @code{WGETRC} is set, Wget will try to load that file.  Failing that, no
1448 further attempts will be made.
1449
1450 If @code{WGETRC} is not set, Wget will try to load @file{$HOME/.wgetrc}.
1451
1452 The fact that user's settings are loaded after the system-wide ones
1453 means that in case of collision user's wgetrc @emph{overrides} the
1454 system-wide wgetrc (in @file{/usr/local/etc/wgetrc} by default).
1455 Fascist admins, away!
1456
1457 @node Wgetrc Syntax, Wgetrc Commands, Wgetrc Location, Startup File
1458 @section Wgetrc Syntax
1459 @cindex wgetrc syntax
1460 @cindex syntax of wgetrc
1461
1462 The syntax of a wgetrc command is simple:
1463
1464 @example
1465 variable = value
1466 @end example
1467
1468 The @dfn{variable} will also be called @dfn{command}.  Valid
1469 @dfn{values} are different for different commands.
1470
1471 The commands are case-insensitive and underscore-insensitive.  Thus
1472 @samp{DIr__PrefiX} is the same as @samp{dirprefix}.  Empty lines, lines
1473 beginning with @samp{#} and lines containing white-space only are
1474 discarded.
1475
1476 Commands that expect a comma-separated list will clear the list on an
1477 empty command.  So, if you wish to reset the rejection list specified in
1478 global @file{wgetrc}, you can do it with:
1479
1480 @example
1481 reject =
1482 @end example
1483
1484 @node Wgetrc Commands, Sample Wgetrc, Wgetrc Syntax, Startup File
1485 @section Wgetrc Commands
1486 @cindex wgetrc commands
1487
1488 The complete set of commands is listed below, the letter after @samp{=}
1489 denoting the value the command takes. It is @samp{on/off} for @samp{on}
1490 or @samp{off} (which can also be @samp{1} or @samp{0}), @var{string} for
1491 any non-empty string or @var{n} for a positive integer.  For example,
1492 you may specify @samp{use_proxy = off} to disable use of proxy servers
1493 by default. You may use @samp{inf} for infinite values, where
1494 appropriate.
1495
1496 Most of the commands have their equivalent command-line option
1497 (@xref{Invoking}), except some more obscure or rarely used ones.
1498
1499 @table @asis
1500 @item accept/reject = @var{string}
1501 Same as @samp{-A}/@samp{-R} (@xref{Types of Files}).
1502
1503 @item add_hostdir = on/off
1504 Enable/disable host-prefixed file names.  @samp{-nH} disables it.
1505
1506 @item continue = on/off
1507 Enable/disable continuation of the retrieval, the same as @samp{-c}
1508 (which enables it).
1509
1510 @item background = on/off
1511 Enable/disable going to background, the same as @samp{-b} (which enables 
1512 it).
1513
1514 @c @item backups = @var{number}
1515 @c #### Document me!
1516 @item base = @var{string}
1517 Set base for relative @sc{url}s, the same as @samp{-B}.
1518
1519 @item cache = on/off
1520 When set to off, disallow server-caching.  See the @samp{-C} option.
1521
1522 @item convert links = on/off
1523 Convert non-relative links locally.  The same as @samp{-k}.
1524
1525 @item cut_dirs = @var{n}
1526 Ignore @var{n} remote directory components.
1527
1528 @item debug = on/off
1529 Debug mode, same as @samp{-d}.
1530
1531 @item delete_after = on/off
1532 Delete after download, the same as @samp{--delete-after}.
1533
1534 @item dir_prefix = @var{string}
1535 Top of directory tree, the same as @samp{-P}.
1536
1537 @item dirstruct = on/off
1538 Turning dirstruct on or off, the same as @samp{-x} or @samp{-nd},
1539 respectively.
1540
1541 @item domains = @var{string}
1542 Same as @samp{-D} (@xref{Domain Acceptance}).
1543
1544 @item dot_bytes = @var{n}
1545 Specify the number of bytes ``contained'' in a dot, as seen throughout
1546 the retrieval (1024 by default).  You can postfix the value with
1547 @samp{k} or @samp{m}, representing kilobytes and megabytes,
1548 respectively.  With dot settings you can tailor the dot retrieval to
1549 suit your needs, or you can use the predefined @dfn{styles}
1550 (@xref{Download Options}).
1551
1552 @item dots_in_line = @var{n}
1553 Specify the number of dots that will be printed in each line throughout
1554 the retrieval (50 by default).
1555
1556 @item dot_spacing = @var{n}
1557 Specify the number of dots in a single cluster (10 by default).
1558
1559 @item dot_style = @var{string}
1560 Specify the dot retrieval @dfn{style}, as with @samp{--dot-style}.
1561
1562 @item exclude_directories = @var{string}
1563 Specify a comma-separated list of directories you wish to exclude from
1564 download, the same as @samp{-X} (@xref{Directory-Based Limits}).
1565
1566 @item exclude_domains = @var{string}
1567 Same as @samp{--exclude-domains} (@xref{Domain Acceptance}).
1568
1569 @item follow_ftp = on/off
1570 Follow @sc{ftp} links from @sc{html} documents, the same as @samp{-f}.
1571
1572 @item force_html = on/off
1573 If set to on, force the input filename to be regarded as an @sc{html}
1574 document, the same as @samp{-F}.
1575
1576 @item ftp_proxy = @var{string}
1577 Use @var{string} as @sc{ftp} proxy, instead of the one specified in
1578 environment.
1579
1580 @item glob = on/off
1581 Turn globbing on/off, the same as @samp{-g}.
1582
1583 @item header = @var{string}
1584 Define an additional header, like @samp{--header}.
1585
1586 @item http_passwd = @var{string}
1587 Set @sc{http} password.
1588
1589 @item http_proxy = @var{string}
1590 Use @var{string} as @sc{http} proxy, instead of the one specified in
1591 environment.
1592
1593 @item http_user = @var{string}
1594 Set @sc{http} user to @var{string}.
1595
1596 @item ignore_length = on/off
1597 When set to on, ignore @code{Content-Length} header; the same as
1598 @samp{--ignore-length}.
1599
1600 @item include_directories = @var{string}
1601 Specify a comma-separated list of directories you wish to follow when
1602 downloading, the same as @samp{-I}.
1603
1604 @item input = @var{string}
1605 Read the @sc{url}s from @var{string}, like @samp{-i}.
1606
1607 @item kill_longer = on/off
1608 Consider data longer than specified in content-length header
1609 as invalid (and retry getting it). The default behaviour is to save
1610 as much data as there is, provided there is more than or equal
1611 to the value in @code{Content-Length}.
1612
1613 @item logfile = @var{string}
1614 Set logfile, the same as @samp{-o}.
1615
1616 @item login = @var{string}
1617 Your user name on the remote machine, for @sc{ftp}.  Defaults to
1618 @samp{anonymous}.
1619
1620 @item mirror = on/off
1621 Turn mirroring on/off.  The same as @samp{-m}.
1622
1623 @item netrc = on/off
1624 Turn reading netrc on or off.
1625
1626 @item noclobber = on/off
1627 Same as @samp{-nc}.
1628
1629 @item no_parent = on/off
1630 Disallow retrieving outside the directory hierarchy, like
1631 @samp{--no-parent} (@xref{Directory-Based Limits}).
1632
1633 @item no_proxy = @var{string}
1634 Use @var{string} as the comma-separated list of domains to avoid in
1635 proxy loading, instead of the one specified in environment.
1636
1637 @item output_document = @var{string}
1638 Set the output filename, the same as @samp{-O}.
1639
1640 @item passive_ftp = on/off
1641 Set passive @sc{ftp}, the same as @samp{--passive-ftp}.
1642
1643 @item passwd = @var{string}
1644 Set your @sc{ftp} password to @var{password}.  Without this setting, the
1645 password defaults to @samp{username@@hostname.domainname}.
1646
1647 @item proxy_user = @var{string}
1648 Set proxy authentication user name to @var{string}, like
1649 @samp{--proxy-user}.
1650
1651 @item proxy_passwd = @var{string}
1652 Set proxy authentication password to @var{string}, like
1653 @samp{--proxy-passwd}.
1654
1655 @item quiet = on/off
1656 Quiet mode, the same as @samp{-q}.
1657
1658 @item quota = @var{quota}
1659 Specify the download quota, which is useful to put in global
1660 wgetrc. When download quota is specified, Wget will stop retrieving
1661 after the download sum has become greater than quota.  The quota can be
1662 specified in bytes (default), kbytes @samp{k} appended) or mbytes
1663 (@samp{m} appended).  Thus @samp{quota = 5m} will set the quota to 5
1664 mbytes. Note that the user's startup file overrides system settings.
1665
1666 @item reclevel = @var{n}
1667 Recursion level, the same as @samp{-l}.
1668
1669 @item recursive = on/off
1670 Recursive on/off, the same as @samp{-r}.
1671
1672 @item relative_only = on/off
1673 Follow only relative links, the same as @samp{-L} (@xref{Relative
1674 Links}).
1675
1676 @item remove_listing = on/off
1677 If set to on, remove @sc{ftp} listings downloaded by Wget.  Setting it
1678 to off is the same as @samp{-nr}.
1679
1680 @item retr_symlinks = on/off
1681 When set to on, retrieve symbolic links as if they were plain files; the
1682 same as @samp{--retr-symlinks}.
1683
1684 @item robots = on/off
1685 Use (or not) @file{/robots.txt} file (@xref{Robots}).  Be sure to know
1686 what you are doing before changing the default (which is @samp{on}).
1687
1688 @item server_response = on/off
1689 Choose whether or not to print the @sc{http} and @sc{ftp} server
1690 responses, the same as @samp{-S}.
1691
1692 @item simple_host_check = on/off
1693 Same as @samp{-nh} (@xref{Host Checking}).
1694
1695 @item span_hosts = on/off
1696 Same as @samp{-H}.
1697
1698 @item timeout = @var{n}
1699 Set timeout value, the same as @samp{-T}.
1700
1701 @item timestamping = on/off
1702 Turn timestamping on/off. The same as @samp{-N} (@xref{Time-Stamping}).
1703
1704 @item tries = @var{n}
1705 Set number of retries per @sc{url}, the same as @samp{-t}.
1706
1707 @item use_proxy = on/off
1708 Turn proxy support on/off. The same as @samp{-Y}.
1709
1710 @item verbose = on/off
1711 Turn verbose on/off, the same as @samp{-v}/@samp{-nv}.
1712
1713 @item wait = @var{n}
1714 Wait @var{n} seconds between retrievals, the same as @samp{-w}.
1715 @end table
1716
1717 @node Sample Wgetrc,  , Wgetrc Commands, Startup File
1718 @section Sample Wgetrc
1719 @cindex sample wgetrc
1720
1721 This is the sample initialization file, as given in the distribution.
1722 It is divided in two section---one for global usage (suitable for global
1723 startup file), and one for local usage (suitable for
1724 @file{$HOME/.wgetrc}).  Be careful about the things you change.
1725
1726 Note that all the lines are commented out.  For any line to have effect,
1727 you must remove the @samp{#} prefix at the beginning of line.
1728
1729 @example
1730 ###
1731 ### Sample Wget initialization file .wgetrc
1732 ###
1733
1734 ## You can use this file to change the default behaviour of wget or to
1735 ## avoid having to type many many command-line options. This file does
1736 ## not contain a comprehensive list of commands -- look at the manual
1737 ## to find out what you can put into this file.
1738 ## 
1739 ## Wget initialization file can reside in /usr/local/etc/wgetrc
1740 ## (global, for all users) or $HOME/.wgetrc (for a single user).
1741 ##
1742 ## To use any of the settings in this file, you will have to uncomment
1743 ## them (and probably change them).
1744
1745
1746 ##
1747 ## Global settings (useful for setting up in /usr/local/etc/wgetrc).
1748 ## Think well before you change them, since they may reduce wget's
1749 ## functionality, and make it behave contrary to the documentation:
1750 ##
1751
1752 # You can set retrieve quota for beginners by specifying a value
1753 # optionally followed by 'K' (kilobytes) or 'M' (megabytes).  The
1754 # default quota is unlimited.
1755 #quota = inf
1756
1757 # You can lower (or raise) the default number of retries when
1758 # downloading a file (default is 20).
1759 #tries = 20
1760
1761 # Lowering the maximum depth of the recursive retrieval is handy to
1762 # prevent newbies from going too "deep" when they unwittingly start
1763 # the recursive retrieval.  The default is 5.
1764 #reclevel = 5
1765
1766 # Many sites are behind firewalls that do not allow initiation of
1767 # connections from the outside.  On these sites you have to use the
1768 # `passive' feature of FTP.  If you are behind such a firewall, you
1769 # can turn this on to make Wget use passive FTP by default.
1770 #passive_ftp = off
1771
1772
1773 ##
1774 ## Local settings (for a user to set in his $HOME/.wgetrc).  It is
1775 ## *highly* undesirable to put these settings in the global file, since
1776 ## they are potentially dangerous to "normal" users.
1777 ##
1778 ## Even when setting up your own ~/.wgetrc, you should know what you
1779 ## are doing before doing so.
1780 ##
1781
1782 # Set this to on to use timestamping by default:
1783 #timestamping = off
1784
1785 # It is a good idea to make Wget send your email address in a `From:'
1786 # header with your request (so that server administrators can contact
1787 # you in case of errors).  Wget does *not* send `From:' by default.
1788 #header = From: Your Name <username@@site.domain>
1789
1790 # You can set up other headers, like Accept-Language.  Accept-Language
1791 # is *not* sent by default.
1792 #header = Accept-Language: en
1793
1794 # You can set the default proxy for Wget to use.  It will override the
1795 # value in the environment.
1796 #http_proxy = http://proxy.yoyodyne.com:18023/
1797
1798 # If you do not want to use proxy at all, set this to off.
1799 #use_proxy = on
1800
1801 # You can customize the retrieval outlook.  Valid options are default,
1802 # binary, mega and micro.
1803 #dot_style = default
1804
1805 # Setting this to off makes Wget not download /robots.txt.  Be sure to
1806 # know *exactly* what /robots.txt is and how it is used before changing
1807 # the default!
1808 #robots = on
1809
1810 # It can be useful to make Wget wait between connections.  Set this to
1811 # the number of seconds you want Wget to wait.
1812 #wait = 0
1813
1814 # You can force creating directory structure, even if a single is being
1815 # retrieved, by setting this to on.
1816 #dirstruct = off
1817
1818 # You can turn on recursive retrieving by default (don't do this if
1819 # you are not sure you know what it means) by setting this to on.
1820 #recursive = off
1821
1822 # To have Wget follow FTP links from HTML files by default, set this
1823 # to on:
1824 #follow_ftp = off
1825 @end example
1826
1827 @node Examples, Various, Startup File, Top
1828 @chapter Examples
1829 @cindex examples
1830
1831 The examples are classified into three sections, because of clarity.
1832 The first section is a tutorial for beginners.  The second section
1833 explains some of the more complex program features.  The third section
1834 contains advice for mirror administrators, as well as even more complex
1835 features (that some would call perverted).
1836
1837 @menu
1838 * Simple Usage::        Simple, basic usage of the program.
1839 * Advanced Usage::      Advanced techniques of usage.
1840 * Guru Usage::          Mirroring and the hairy stuff.
1841 @end menu
1842
1843 @node Simple Usage, Advanced Usage, Examples, Examples
1844 @section Simple Usage
1845
1846 @itemize @bullet
1847 @item
1848 Say you want to download a @sc{url}.  Just type:
1849
1850 @example
1851 wget http://fly.cc.fer.hr/
1852 @end example
1853
1854 The response will be something like:
1855
1856 @example
1857 @group
1858 --13:30:45--  http://fly.cc.fer.hr:80/en/
1859            => `index.html'
1860 Connecting to fly.cc.fer.hr:80... connected!
1861 HTTP request sent, awaiting response... 200 OK
1862 Length: 4,694 [text/html]
1863
1864     0K -> ....                                                   [100%]
1865
1866 13:30:46 (23.75 KB/s) - `index.html' saved [4694/4694]
1867 @end group
1868 @end example
1869
1870 @item
1871 But what will happen if the connection is slow, and the file is lengthy?
1872 The connection will probably fail before the whole file is retrieved,
1873 more than once.  In this case, Wget will try getting the file until it
1874 either gets the whole of it, or exceeds the default number of retries
1875 (this being 20).  It is easy to change the number of tries to 45, to
1876 insure that the whole file will arrive safely:
1877
1878 @example
1879 wget --tries=45 http://fly.cc.fer.hr/jpg/flyweb.jpg
1880 @end example
1881
1882 @item
1883 Now let's leave Wget to work in the background, and write its progress
1884 to log file @file{log}.  It is tiring to type @samp{--tries}, so we
1885 shall use @samp{-t}.
1886
1887 @example
1888 wget -t 45 -o log http://fly.cc.fer.hr/jpg/flyweb.jpg &
1889 @end example
1890
1891 The ampersand at the end of the line makes sure that Wget works in the
1892 background.  To unlimit the number of retries, use @samp{-t inf}.
1893
1894 @item
1895 The usage of @sc{ftp} is as simple.  Wget will take care of login and
1896 password.
1897
1898 @example
1899 @group
1900 $ wget ftp://gnjilux.cc.fer.hr/welcome.msg
1901 --10:08:47--  ftp://gnjilux.cc.fer.hr:21/welcome.msg
1902            => `welcome.msg'
1903 Connecting to gnjilux.cc.fer.hr:21... connected!
1904 Logging in as anonymous ... Logged in!
1905 ==> TYPE I ... done.  ==> CWD not needed.
1906 ==> PORT ... done.    ==> RETR welcome.msg ... done.
1907 Length: 1,340 (unauthoritative)
1908
1909     0K -> .                                                      [100%]
1910
1911 10:08:48 (1.28 MB/s) - `welcome.msg' saved [1340]
1912 @end group
1913 @end example
1914
1915 @item
1916 If you specify a directory, Wget will retrieve the directory listing,
1917 parse it and convert it to @sc{html}.  Try:
1918
1919 @example
1920 wget ftp://prep.ai.mit.edu/pub/gnu/
1921 lynx index.html
1922 @end example
1923 @end itemize
1924
1925 @node Advanced Usage, Guru Usage, Simple Usage, Examples
1926 @section Advanced Usage
1927
1928 @itemize @bullet
1929 @item
1930 You would like to read the list of @sc{url}s from a file?  Not a problem
1931 with that:
1932
1933 @example
1934 wget -i file
1935 @end example
1936
1937 If you specify @samp{-} as file name, the @sc{url}s will be read from
1938 standard input.
1939
1940 @item
1941 Create a mirror image of GNU @sc{www} site (with the same directory structure
1942 the original has) with only one try per document, saving the log of the
1943 activities to @file{gnulog}:
1944
1945 @example
1946 wget -r -t1 http://www.gnu.ai.mit.edu/ -o gnulog
1947 @end example
1948
1949 @item
1950 Retrieve the first layer of yahoo links:
1951
1952 @example
1953 wget -r -l1 http://www.yahoo.com/
1954 @end example
1955
1956 @item
1957 Retrieve the index.html of @samp{www.lycos.com}, showing the original
1958 server headers:
1959
1960 @example
1961 wget -S http://www.lycos.com/
1962 @end example
1963
1964 @item
1965 Save the server headers with the file:
1966 @example
1967 wget -s http://www.lycos.com/
1968 more index.html
1969 @end example
1970
1971 @item
1972 Retrieve the first two levels of @samp{wuarchive.wustl.edu}, saving them
1973 to /tmp.
1974
1975 @example
1976 wget -P/tmp -l2 ftp://wuarchive.wustl.edu/
1977 @end example
1978
1979 @item
1980 You want to download all the @sc{gif}s from an @sc{http} directory.
1981 @samp{wget http://host/dir/*.gif} doesn't work, since @sc{http}
1982 retrieval does not support globbing.  In that case, use:
1983
1984 @example
1985 wget -r -l1 --no-parent -A.gif http://host/dir/
1986 @end example
1987
1988 It is a bit of a kludge, but it works.  @samp{-r -l1} means to retrieve
1989 recursively (@xref{Recursive Retrieval}), with maximum depth of 1.
1990 @samp{--no-parent} means that references to the parent directory are
1991 ignored (@xref{Directory-Based Limits}), and @samp{-A.gif} means to
1992 download only the @sc{gif} files.  @samp{-A "*.gif"} would have worked
1993 too.
1994
1995 @item
1996 Suppose you were in the middle of downloading, when Wget was
1997 interrupted.  Now you do not want to clobber the files already present.
1998 It would be:
1999
2000 @example
2001 wget -nc -r http://www.gnu.ai.mit.edu/
2002 @end example
2003
2004 @item
2005 If you want to encode your own username and password to @sc{http} or
2006 @sc{ftp}, use the appropriate @sc{url} syntax (@xref{URL Format}).
2007
2008 @example
2009 wget ftp://hniksic:mypassword@@jagor.srce.hr/.emacs
2010 @end example
2011
2012 @item
2013 If you do not like the default retrieval visualization (1K dots with 10
2014 dots per cluster and 50 dots per line), you can customize it through dot
2015 settings (@xref{Wgetrc Commands}).  For example, many people like the
2016 ``binary'' style of retrieval, with 8K dots and 512K lines:
2017
2018 @example
2019 wget --dot-style=binary ftp://prep.ai.mit.edu/pub/gnu/README
2020 @end example
2021
2022 You can experiment with other styles, like:
2023
2024 @example
2025 wget --dot-style=mega ftp://ftp.xemacs.org/pub/xemacs/xemacs-20.4/xemacs-20.4.tar.gz
2026 wget --dot-style=micro http://fly.cc.fer.hr/
2027 @end example
2028
2029 To make these settings permanent, put them in your @file{.wgetrc}, as
2030 described before (@xref{Sample Wgetrc}).
2031 @end itemize
2032
2033 @node Guru Usage,  , Advanced Usage, Examples
2034 @section Guru Usage
2035
2036 @cindex mirroring
2037 @itemize @bullet
2038 @item
2039 If you wish Wget to keep a mirror of a page (or @sc{ftp}
2040 subdirectories), use @samp{--mirror} (@samp{-m}), which is the shorthand
2041 for @samp{-r -N}.  You can put Wget in the crontab file asking it to
2042 recheck a site each Sunday:
2043
2044 @example
2045 crontab
2046 0 0 * * 0 wget --mirror ftp://ftp.xemacs.org/pub/xemacs/ -o /home/me/weeklog
2047 @end example
2048
2049 @item
2050 You may wish to do the same with someone's home page.  But you do not
2051 want to download all those images---you're only interested in @sc{html}.
2052
2053 @example
2054 wget --mirror -A.html http://www.w3.org/
2055 @end example
2056
2057 @item
2058 But what about mirroring the hosts networkologically close to you?  It
2059 seems so awfully slow because of all that @sc{dns} resolving.  Just use
2060 @samp{-D} (@xref{Domain Acceptance}).
2061
2062 @example
2063 wget -rN -Dsrce.hr http://www.srce.hr/
2064 @end example
2065
2066 Now Wget will correctly find out that @samp{regoc.srce.hr} is the same
2067 as @samp{www.srce.hr}, but will not even take into consideration the
2068 link to @samp{www.mit.edu}.
2069
2070 @item
2071 You have a presentation and would like the dumb absolute links to be
2072 converted to relative?  Use @samp{-k}:
2073
2074 @example
2075 wget -k -r @var{URL}
2076 @end example
2077
2078 @cindex redirecting output
2079 @item
2080 You would like the output documents to go to standard output instead of
2081 to files?  OK, but Wget will automatically shut up (turn on
2082 @samp{--quiet}) to prevent mixing of Wget output and the retrieved
2083 documents.
2084
2085 @example
2086 wget -O - http://jagor.srce.hr/ http://www.srce.hr/
2087 @end example
2088
2089 You can also combine the two options and make weird pipelines to
2090 retrieve the documents from remote hotlists:
2091
2092 @example
2093 wget -O - http://cool.list.com/ | wget --force-html -i -
2094 @end example
2095 @end itemize
2096
2097 @node Various, Appendices, Examples, Top
2098 @chapter Various
2099 @cindex various
2100
2101 This chapter contains all the stuff that could not fit anywhere else.
2102
2103 @menu
2104 * Proxies::             Support for proxy servers
2105 * Distribution::        Getting the latest version.
2106 * Mailing List::        Wget mailing list for announcements and discussion.
2107 * Reporting Bugs::      How and where to report bugs.
2108 * Portability::         The systems Wget works on.
2109 * Signals::             Signal-handling performed by Wget.
2110 @end menu
2111
2112 @node Proxies, Distribution, Various, Various
2113 @section Proxies
2114 @cindex proxies
2115
2116 @dfn{Proxies} are special-purpose @sc{http} servers designed to transfer
2117 data from remote servers to local clients.  One typical use of proxies
2118 is lightening network load for users behind a slow connection.  This is
2119 achieved by channeling all @sc{http} and @sc{ftp} requests through the
2120 proxy which caches the transferred data.  When a cached resource is
2121 requested again, proxy will return the data from cache.  Another use for
2122 proxies is for companies that separate (for security reasons) their
2123 internal networks from the rest of Internet.  In order to obtain
2124 information from the Web, their users connect and retrieve remote data
2125 using an authorized proxy.
2126
2127 Wget supports proxies for both @sc{http} and @sc{ftp} retrievals.  The
2128 standard way to specify proxy location, which Wget recognizes, is using
2129 the following environment variables:
2130
2131 @table @code
2132 @item http_proxy
2133 This variable should contain the @sc{url} of the proxy for @sc{http}
2134 connections.
2135
2136 @item ftp_proxy
2137 This variable should contain the @sc{url} of the proxy for @sc{http}
2138 connections.  It is quite common that @sc{http_proxy} and @sc{ftp_proxy} 
2139 are set to the same @sc{url}.
2140
2141 @item no_proxy
2142 This variable should contain a comma-separated list of domain extensions 
2143 proxy should @emph{not} be used for.  For instance, if the value of
2144 @code{no_proxy} is @samp{.mit.edu}, proxy will not be used to retrieve
2145 documents from MIT.
2146 @end table
2147
2148 In addition to the environment variables, proxy location and settings
2149 may be specified from within Wget itself.
2150
2151 @table @samp
2152 @item -Y on/off
2153 @itemx --proxy=on/off
2154 @itemx proxy = on/off
2155 This option may be used to turn the proxy support on or off.  Proxy
2156 support is on by default, provided that the appropriate environment
2157 variables are set.
2158
2159 @item http_proxy = @var{URL}
2160 @itemx ftp_proxy = @var{URL}
2161 @itemx no_proxy = @var{string}
2162 These startup file variables allow you to override the proxy settings
2163 specified by the environment.
2164 @end table
2165
2166 Some proxy servers require authorization to enable you to use them.  The
2167 authorization consists of @dfn{username} and @dfn{password}, which must
2168 be sent by Wget.  As with @sc{http} authorization, several
2169 authentication schemes exist.  For proxy authorization only the
2170 @code{Basic} authentication scheme is currently implemented.
2171
2172 You may specify your username and password either through the proxy
2173 @sc{url} or through the command-line options.  Assuming that the
2174 company's proxy is located at @samp{proxy.srce.hr} at port 8001, a proxy
2175 @sc{url} location containing authorization data might look like this:
2176
2177 @example
2178 http://hniksic:mypassword@@proxy.company.com:8001/
2179 @end example
2180
2181 Alternatively, you may use the @samp{proxy-user} and
2182 @samp{proxy-password} options, and the equivalent @file{.wgetrc}
2183 settings @code{proxy_user} and @code{proxy_passwd} to set the proxy
2184 username and password.
2185
2186 @node Distribution, Mailing List, Proxies, Various
2187 @section Distribution
2188 @cindex latest version
2189
2190 Like all GNU utilities, the latest version of Wget can be found at the
2191 master GNU archive site prep.ai.mit.edu, and its mirrors.  For example,
2192 Wget @value{VERSION} can be found at
2193 @url{ftp://prep.ai.mit.edu/pub/gnu/wget-@value{VERSION}.tar.gz}
2194
2195 @node Mailing List, Reporting Bugs, Distribution, Various
2196 @section Mailing List
2197 @cindex mailing list
2198 @cindex list
2199
2200 Wget has its own mailing list at @email{wget@@sunsite.auc.dk}, thanks
2201 to Karsten Thygesen.  The mailing list is for discussion of Wget
2202 features and web, reporting Wget bugs (those that you think may be of
2203 interest to the public) and mailing announcements.  You are welcome to
2204 subscribe.  The more people on the list, the better!
2205
2206 To subscribe, send mail to @email{wget-subscribe@@sunsite.auc.dk}.
2207 the magic word @samp{subscribe} in the subject line.  Unsubscribe by
2208 mailing to @email{wget-unsubscribe@@sunsite.auc.dk}.
2209
2210 The mailing list is archived at @url{http://fly.cc.fer.hr/archive/wget}.
2211
2212 @node Reporting Bugs, Portability, Mailing List, Various
2213 @section Reporting Bugs
2214 @cindex bugs
2215 @cindex reporting bugs
2216 @cindex bug reports
2217
2218 You are welcome to send bug reports about GNU Wget to
2219 @email{bug-wget@@gnu.org}.  The bugs that you think are of the
2220 interest to the public (i.e. more people should be informed about them)
2221 can be Cc-ed to the mailing list at @email{wget@@sunsite.auc.dk}.
2222
2223 Before actually submitting a bug report, please try to follow a few
2224 simple guidelines.
2225
2226 @enumerate
2227 @item
2228 Please try to ascertain that the behaviour you see really is a bug.  If
2229 Wget crashes, it's a bug.  If Wget does not behave as documented,
2230 it's a bug.  If things work strange, but you are not sure about the way
2231 they are supposed to work, it might well be a bug.
2232
2233 @item
2234 Try to repeat the bug in as simple circumstances as possible.  E.g. if
2235 Wget crashes on @samp{wget -rLl0 -t5 -Y0 http://yoyodyne.com -o
2236 /tmp/log}, you should try to see if it will crash with a simpler set of
2237 options.
2238
2239 Also, while I will probably be interested to know the contents of your
2240 @file{.wgetrc} file, just dumping it into the debug message is probably
2241 a bad idea.  Instead, you should first try to see if the bug repeats
2242 with @file{.wgetrc} moved out of the way.  Only if it turns out that
2243 @file{.wgetrc} settings affect the bug, should you mail me the relevant
2244 parts of the file.
2245
2246 @item
2247 Please start Wget with @samp{-d} option and send the log (or the
2248 relevant parts of it).  If Wget was compiled without debug support,
2249 recompile it.  It is @emph{much} easier to trace bugs with debug support
2250 on.
2251
2252 @item
2253 If Wget has crashed, try to run it in a debugger, e.g. @code{gdb `which
2254 wget` core} and type @code{where} to get the backtrace.
2255
2256 @item
2257 Find where the bug is, fix it and send me the patches. :-)
2258 @end enumerate
2259
2260 @node Portability, Signals, Reporting Bugs, Various
2261 @section Portability
2262 @cindex portability
2263 @cindex operating systems
2264
2265 Since Wget uses GNU Autoconf for building and configuring, and avoids
2266 using ``special'' ultra--mega--cool features of any particular Unix, it
2267 should compile (and work) on all common Unix flavors.
2268
2269 Various Wget versions have been compiled and tested under many kinds of
2270 Unix systems, including Solaris, Linux, SunOS, OSF (aka Digital Unix),
2271 Ultrix, *BSD, IRIX, and others; refer to the file @file{MACHINES} in the
2272 distribution directory for a comprehensive list.  If you compile it on
2273 an architecture not listed there, please let me know so I can update it.
2274
2275 Wget should also compile on the other Unix systems, not listed in
2276 @file{MACHINES}.  If it doesn't, please let me know.
2277
2278 Thanks to kind contributors, this version of Wget compiles and works on
2279 Microsoft Windows 95 and Windows NT platforms.  It has been compiled
2280 successfully using MS Visual C++ 4.0, Watcom, and Borland C compilers,
2281 with Winsock as networking software.  Naturally, it is crippled of some
2282 features available on Unix, but it should work as a substitute for
2283 people stuck with Windows.  Note that the Windows port is
2284 @strong{neither tested nor maintained} by me---all questions and
2285 problems should be reported to Wget mailing list at
2286 @email{wget@@sunsite.auc.dk} where the maintainers will look at them.
2287
2288 @node Signals,  , Portability, Various
2289 @section Signals
2290 @cindex signal handling
2291 @cindex hangup
2292
2293 Since the purpose of Wget is background work, it catches the hangup
2294 signal (@code{SIGHUP}) and ignores it.  If the output was on standard
2295 output, it will be redirected to a file named @file{wget-log}.
2296 Otherwise, @code{SIGHUP} is ignored.  This is convenient when you wish
2297 to redirect the output of Wget after having started it.
2298
2299 @example
2300 $ wget http://www.ifi.uio.no/~larsi/gnus.tar.gz &
2301 $ kill -HUP %%     # Redirect the output to wget-log
2302 @end example
2303
2304 Other than that, Wget will not try to interfere with signals in any
2305 way. @kbd{C-c}, @code{kill -TERM} and @code{kill -KILL} should kill it
2306 alike.
2307
2308 @node Appendices, Copying, Various, Top
2309 @chapter Appendices
2310
2311 This chapter contains some references I consider useful, like the Robots
2312 Exclusion Standard specification, as well as a list of contributors to
2313 GNU Wget.
2314
2315 @menu
2316 * Robots::                  Wget as a WWW robot.
2317 * Security Considerations:: Security with Wget.
2318 * Contributors::            People who helped.
2319 @end menu
2320
2321 @node Robots, Security Considerations, Appendices, Appendices
2322 @section Robots
2323 @cindex robots
2324 @cindex robots.txt
2325 @cindex server maintenance
2326
2327 Since Wget is able to traverse the web, it counts as one of the Web
2328 @dfn{robots}.  Thus Wget understands @dfn{Robots Exclusion Standard}
2329 (@sc{res})---contents of @file{/robots.txt}, used by server
2330 administrators to shield parts of their systems from wanderings of Wget.
2331
2332 Norobots support is turned on only when retrieving recursively, and
2333 @emph{never} for the first page.  Thus, you may issue:
2334
2335 @example
2336 wget -r http://fly.cc.fer.hr/
2337 @end example
2338
2339 First the index of fly.cc.fer.hr will be downloaded.  If Wget finds
2340 anything worth downloading on the same host, only @emph{then} will it
2341 load the robots, and decide whether or not to load the links after all.
2342 @file{/robots.txt} is loaded only once per host.  Wget does not support
2343 the robots @code{META} tag.
2344
2345 The description of the norobots standard was written, and is maintained
2346 by Martijn Koster @email{m.koster@@webcrawler.com}.  With his
2347 permission, I contribute a (slightly modified) texified version of the
2348 @sc{res}.
2349
2350 @menu
2351 * Introduction to RES::
2352 * RES Format::
2353 * User-Agent Field::
2354 * Disallow Field::
2355 * Norobots Examples::
2356 @end menu
2357
2358 @node Introduction to RES, RES Format, Robots, Robots
2359 @subsection Introduction to RES
2360 @cindex norobots introduction
2361
2362 @dfn{WWW Robots} (also called @dfn{wanderers} or @dfn{spiders}) are
2363 programs that traverse many pages in the World Wide Web by recursively
2364 retrieving linked pages. For more information see the robots page.
2365
2366 In 1993 and 1994 there have been occasions where robots have visited
2367 @sc{www} servers where they weren't welcome for various
2368 reasons. Sometimes these reasons were robot specific, e.g. certain
2369 robots swamped servers with rapid-fire requests, or retrieved the same
2370 files repeatedly. In other situations robots traversed parts of @sc{www}
2371 servers that weren't suitable, e.g. very deep virtual trees, duplicated
2372 information, temporary information, or cgi-scripts with side-effects
2373 (such as voting).
2374
2375 These incidents indicated the need for established mechanisms for
2376 @sc{www} servers to indicate to robots which parts of their server
2377 should not be accessed. This standard addresses this need with an
2378 operational solution.
2379
2380 This document represents a consensus on 30 June 1994 on the robots
2381 mailing list (@code{robots@@webcrawler.com}), between the majority of
2382 robot authors and other people with an interest in robots. It has also
2383 been open for discussion on the Technical World Wide Web mailing list
2384 (@code{www-talk@@info.cern.ch}). This document is based on a previous
2385 working draft under the same title.
2386
2387 It is not an official standard backed by a standards body, or owned by
2388 any commercial organization. It is not enforced by anybody, and there
2389 no guarantee that all current and future robots will use it. Consider
2390 it a common facility the majority of robot authors offer the @sc{www}
2391 community to protect @sc{www} server against unwanted accesses by their
2392 robots.
2393
2394 The latest version of this document can be found at
2395 @url{http://info.webcrawler.com/mak/projects/robots/norobots.html}.
2396
2397 @node RES Format, User-Agent Field, Introduction to RES, Robots
2398 @subsection RES Format
2399 @cindex norobots format
2400
2401 The format and semantics of the @file{/robots.txt} file are as follows:
2402
2403 The file consists of one or more records separated by one or more blank
2404 lines (terminated by @code{CR}, @code{CR/NL}, or @code{NL}).  Each
2405 record contains lines of the form:
2406
2407 @example
2408 <field>:<optionalspace><value><optionalspace>
2409 @end example
2410
2411 The field name is case insensitive.
2412    
2413 Comments can be included in file using UNIX bourne shell conventions:
2414 the @samp{#} character is used to indicate that preceding space (if any)
2415 and the remainder of the line up to the line termination is discarded.
2416 Lines containing only a comment are discarded completely, and therefore
2417 do not indicate a record boundary.
2418
2419 The record starts with one or more User-agent lines, followed by one or
2420 more Disallow lines, as detailed below. Unrecognized headers are
2421 ignored.
2422
2423 The presence of an empty @file{/robots.txt} file has no explicit
2424 associated semantics, it will be treated as if it was not present,
2425 i.e. all robots will consider themselves welcome.
2426
2427 @node User-Agent Field, Disallow Field, RES Format, Robots
2428 @subsection User-Agent Field
2429 @cindex norobots user-agent
2430
2431 The value of this field is the name of the robot the record is
2432 describing access policy for.
2433
2434 If more than one User-agent field is present the record describes an
2435 identical access policy for more than one robot.  At least one field
2436 needs to be present per record.
2437
2438 The robot should be liberal in interpreting this field. A case
2439 insensitive substring match of the name without version information is
2440 recommended.
2441
2442 If the value is @samp{*}, the record describes the default access policy
2443 for any robot that has not matched any of the other records. It is not
2444 allowed to have multiple such records in the @file{/robots.txt} file.
2445
2446 @node Disallow Field, Norobots Examples, User-Agent Field, Robots
2447 @subsection Disallow Field
2448 @cindex norobots disallow
2449
2450 The value of this field specifies a partial @sc{url} that is not to be
2451 visited. This can be a full path, or a partial path; any @sc{url} that
2452 starts with this value will not be retrieved. For example,
2453 @w{@samp{Disallow: /help}} disallows both @samp{/help.html} and
2454 @samp{/help/index.html}, whereas @w{@samp{Disallow: /help/}} would
2455 disallow @samp{/help/index.html} but allow @samp{/help.html}.
2456
2457 Any empty value, indicates that all @sc{url}s can be retrieved. At least
2458 one Disallow field needs to be present in a record.
2459
2460 @node Norobots Examples,  , Disallow Field, Robots
2461 @subsection Norobots Examples
2462 @cindex norobots examples
2463
2464 The following example @samp{/robots.txt} file specifies that no robots
2465 should visit any @sc{url} starting with @samp{/cyberworld/map/} or
2466 @samp{/tmp/}:
2467
2468 @example
2469 # robots.txt for http://www.site.com/
2470
2471 User-agent: *
2472 Disallow: /cyberworld/map/ # This is an infinite virtual URL space
2473 Disallow: /tmp/ # these will soon disappear
2474 @end example
2475
2476 This example @samp{/robots.txt} file specifies that no robots should
2477 visit any @sc{url} starting with @samp{/cyberworld/map/}, except the
2478 robot called @samp{cybermapper}:
2479
2480 @example
2481 # robots.txt for http://www.site.com/
2482
2483 User-agent: *
2484 Disallow: /cyberworld/map/ # This is an infinite virtual URL space
2485
2486 # Cybermapper knows where to go.
2487 User-agent: cybermapper
2488 Disallow:
2489 @end example
2490
2491 This example indicates that no robots should visit this site further:
2492
2493 @example
2494 # go away
2495 User-agent: *
2496 Disallow: /
2497 @end example
2498
2499 @node Security Considerations, Contributors, Robots, Appendices
2500 @section Security Considerations
2501 @cindex security
2502
2503 When using Wget, you must be aware that it sends unencrypted passwords
2504 through the network, which may present a security problem.  Here are the
2505 main issues, and some solutions.
2506
2507 @enumerate
2508 @item
2509 The passwords on the command line are visible using @code{ps}.  If this
2510 is a problem, avoid putting passwords from the command line---e.g. you
2511 can use @file{.netrc} for this.
2512
2513 @item
2514 Using the insecure @dfn{basic} authentication scheme, unencrypted
2515 passwords are transmitted through the network routers and gateways.
2516
2517 @item
2518 The @sc{ftp} passwords are also in no way encrypted.  There is no good
2519 solution for this at the moment.
2520
2521 @item
2522 Although the ``normal'' output of Wget tries to hide the passwords,
2523 debugging logs show them, in all forms.  This problem is avoided by
2524 being careful when you send debug logs (yes, even when you send them to
2525 me).
2526 @end enumerate
2527
2528 @node Contributors,  , Security Considerations, Appendices
2529 @section Contributors
2530 @cindex contributors
2531
2532 @iftex
2533 GNU Wget was written by Hrvoje Nik@v{s}i@'{c} @email{hniksic@@srce.hr}.
2534 @end iftex
2535 @ifinfo
2536 GNU Wget was written by Hrvoje Niksic @email{hniksic@@srce.hr}.
2537 @end ifinfo
2538 However, its development could never have gone as far as it has, were it
2539 not for the help of many people, either with bug reports, feature
2540 proposals, patches, or letters saying ``Thanks!''.
2541
2542 Special thanks goes to the following people (no particular order):
2543
2544 @itemize @bullet
2545 @item
2546 Karsten Thygesen---donated the mailing list and the initial @sc{ftp}
2547 space.
2548
2549 @item
2550 Shawn McHorse---bug reports and patches.
2551
2552 @item
2553 Kaveh R. Ghazi---on-the-fly @code{ansi2knr}-ization.
2554
2555 @item
2556 Gordon Matzigkeit---@file{.netrc} support.
2557
2558 @item
2559 @iftex
2560 Zlatko @v{C}alu@v{s}i@'{c}, Tomislav Vujec and Dra@v{z}en
2561 Ka@v{c}ar---feature suggestions and ``philosophical'' discussions.
2562 @end iftex
2563 @ifinfo
2564 Zlatko Calusic, Tomislav Vujec and Drazen Kacar---feature suggestions
2565 and ``philosophical'' discussions.
2566 @end ifinfo
2567
2568 @item
2569 Darko Budor---initial port to Windows.
2570
2571 @item
2572 Antonio Rosella---help and suggestions, plust the Italian translation.
2573
2574 @item
2575 @iftex
2576 Tomislav Petrovi@'{c}, Mario Miko@v{c}evi@'{c}---many bug reports and
2577 suggestions.
2578 @end iftex
2579 @ifinfo
2580 Tomislav Petrovic, Mario Mikocevic---many bug reports and suggestions.
2581 @end ifinfo
2582
2583 @item
2584 @iftex
2585 Fran@,{c}ois Pinard---many thorough bug reports and discussions.
2586 @end iftex
2587 @ifinfo
2588 Francois Pinard---many thorough bug reports and discussions.
2589 @end ifinfo
2590
2591 @item
2592 Karl Eichwalder---lots of help with internationalization and other
2593 things.
2594
2595 @item
2596 Junio Hamano---donated support for Opie and @sc{http} @code{Digest}
2597 authentication.
2598
2599 @item
2600 Brian Gough---a generous donation.
2601 @end itemize
2602
2603 The following people have provided patches, bug/build reports, useful
2604 suggestions, beta testing services, fan mail and all the other things
2605 that make maintenance so much fun:
2606
2607 Tim Adam,
2608 Martin Baehr,
2609 Dieter Baron,
2610 Roger Beeman and the Gurus at Cisco,
2611 Mark Boyns,
2612 John Burden,
2613 Wanderlei Cavassin,
2614 Gilles Cedoc,
2615 Tim Charron,
2616 Noel Cragg,
2617 @iftex
2618 Kristijan @v{C}onka@v{s},
2619 @end iftex
2620 @ifinfo
2621 Kristijan Conkas,
2622 @end ifinfo
2623 @iftex
2624 Damir D@v{z}eko,
2625 @end iftex
2626 @ifinfo
2627 Damir Dzeko,
2628 @end ifinfo
2629 Andrew Davison,
2630 Ulrich Drepper,
2631 Marc Duponcheel,
2632 @iftex
2633 Aleksandar Erkalovi@'{c},
2634 @end iftex
2635 @ifinfo
2636 Aleksandar Erkalovic,
2637 @end ifinfo
2638 Andy Eskilsson,
2639 Masashi Fujita,
2640 Howard Gayle,
2641 Marcel Gerrits,
2642 Hans Grobler,
2643 Mathieu Guillaume,
2644 Karl Heuer,
2645 Gregor Hoffleit,
2646 Erik Magnus Hulthen,
2647 Richard Huveneers,
2648 Simon Josefsson,
2649 @iftex
2650 Mario Juri@'{c},
2651 @end iftex
2652 @ifinfo
2653 Mario Juric,
2654 @end ifinfo
2655 @iftex
2656 Goran Kezunovi@'{c},
2657 @end iftex
2658 @ifinfo
2659 Goran Kezunovic,
2660 @end ifinfo
2661 Robert Kleine,
2662 Fila Kolodny,
2663 Alexander Kourakos,
2664 Martin Kraemer,
2665 @tex
2666 $\Sigma\acute{\iota}\mu o\varsigma\;
2667 \Xi\varepsilon\nu\iota\tau\acute{\epsilon}\lambda\lambda\eta\varsigma$
2668 (Simos KSenitellis),
2669 @end tex
2670 @ifinfo
2671 Simos KSenitellis,
2672 @end ifinfo
2673 Tage Stabell-Kulo,
2674 Hrvoje Lacko,
2675 Dave Love,
2676 Jordan Mendelson,
2677 Lin Zhe Min,
2678 Charlie Negyesi,
2679 Andrew Pollock,
2680 Steve Pothier,
2681 Marin Purgar,
2682 Jan Prikryl,
2683 Keith Refson,
2684 Tobias Ringstrom,
2685 @c Texinfo doesn't grok @'{@i}, so we have to use TeX itself.
2686 @tex
2687 Juan Jos\'{e} Rodr\'{\i}gues,
2688 @end tex
2689 @ifinfo
2690 Juan Jose Rodrigues,
2691 @end ifinfo
2692 Heinz Salzmann,
2693 Robert Schmidt,
2694 Toomas Soome,
2695 Sven Sternberger,
2696 Markus Strasser,
2697 Szakacsits Szabolcs,
2698 Mike Thomas,
2699 Russell Vincent,
2700 Douglas E. Wegscheid,
2701 Jasmin Zainul,
2702 @iftex
2703 Bojan @v{Z}drnja,
2704 @end iftex
2705 @ifinfo
2706 Bojan Zdrnja,
2707 @end ifinfo
2708 Kristijan Zimmer.
2709
2710 Apologies to all who I accidentally left out, and many thanks to all the
2711 subscribers of the Wget mailing list.
2712
2713 @node Copying, Concept Index, Appendices, Top
2714 @unnumbered GNU GENERAL PUBLIC LICENSE
2715 @cindex copying
2716 @cindex GPL
2717 @center Version 2, June 1991
2718
2719 @display
2720 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
2721 675 Mass Ave, Cambridge, MA 02139, USA
2722
2723 Everyone is permitted to copy and distribute verbatim copies
2724 of this license document, but changing it is not allowed.
2725 @end display
2726
2727 @unnumberedsec Preamble
2728
2729   The licenses for most software are designed to take away your
2730 freedom to share and change it.  By contrast, the GNU General Public
2731 License is intended to guarantee your freedom to share and change free
2732 software---to make sure the software is free for all its users.  This
2733 General Public License applies to most of the Free Software
2734 Foundation's software and to any other program whose authors commit to
2735 using it.  (Some other Free Software Foundation software is covered by
2736 the GNU Library General Public License instead.)  You can apply it to
2737 your programs, too.
2738
2739   When we speak of free software, we are referring to freedom, not
2740 price.  Our General Public Licenses are designed to make sure that you
2741 have the freedom to distribute copies of free software (and charge for
2742 this service if you wish), that you receive source code or can get it
2743 if you want it, that you can change the software or use pieces of it
2744 in new free programs; and that you know you can do these things.
2745
2746   To protect your rights, we need to make restrictions that forbid
2747 anyone to deny you these rights or to ask you to surrender the rights.
2748 These restrictions translate to certain responsibilities for you if you
2749 distribute copies of the software, or if you modify it.
2750
2751   For example, if you distribute copies of such a program, whether
2752 gratis or for a fee, you must give the recipients all the rights that
2753 you have.  You must make sure that they, too, receive or can get the
2754 source code.  And you must show them these terms so they know their
2755 rights.
2756
2757   We protect your rights with two steps: (1) copyright the software, and
2758 (2) offer you this license which gives you legal permission to copy,
2759 distribute and/or modify the software.
2760
2761   Also, for each author's protection and ours, we want to make certain
2762 that everyone understands that there is no warranty for this free
2763 software.  If the software is modified by someone else and passed on, we
2764 want its recipients to know that what they have is not the original, so
2765 that any problems introduced by others will not reflect on the original
2766 authors' reputations.
2767
2768   Finally, any free program is threatened constantly by software
2769 patents.  We wish to avoid the danger that redistributors of a free
2770 program will individually obtain patent licenses, in effect making the
2771 program proprietary.  To prevent this, we have made it clear that any
2772 patent must be licensed for everyone's free use or not licensed at all.
2773
2774   The precise terms and conditions for copying, distribution and
2775 modification follow.
2776
2777 @iftex
2778 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2779 @end iftex
2780 @ifinfo
2781 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2782 @end ifinfo
2783
2784 @enumerate
2785 @item
2786 This License applies to any program or other work which contains
2787 a notice placed by the copyright holder saying it may be distributed
2788 under the terms of this General Public License.  The ``Program'', below,
2789 refers to any such program or work, and a ``work based on the Program''
2790 means either the Program or any derivative work under copyright law:
2791 that is to say, a work containing the Program or a portion of it,
2792 either verbatim or with modifications and/or translated into another
2793 language.  (Hereinafter, translation is included without limitation in
2794 the term ``modification''.)  Each licensee is addressed as ``you''.
2795
2796 Activities other than copying, distribution and modification are not
2797 covered by this License; they are outside its scope.  The act of
2798 running the Program is not restricted, and the output from the Program
2799 is covered only if its contents constitute a work based on the
2800 Program (independent of having been made by running the Program).
2801 Whether that is true depends on what the Program does.
2802
2803 @item
2804 You may copy and distribute verbatim copies of the Program's
2805 source code as you receive it, in any medium, provided that you
2806 conspicuously and appropriately publish on each copy an appropriate
2807 copyright notice and disclaimer of warranty; keep intact all the
2808 notices that refer to this License and to the absence of any warranty;
2809 and give any other recipients of the Program a copy of this License
2810 along with the Program.
2811
2812 You may charge a fee for the physical act of transferring a copy, and
2813 you may at your option offer warranty protection in exchange for a fee.
2814
2815 @item
2816 You may modify your copy or copies of the Program or any portion
2817 of it, thus forming a work based on the Program, and copy and
2818 distribute such modifications or work under the terms of Section 1
2819 above, provided that you also meet all of these conditions:
2820
2821 @enumerate a
2822 @item
2823 You must cause the modified files to carry prominent notices
2824 stating that you changed the files and the date of any change.
2825
2826 @item
2827 You must cause any work that you distribute or publish, that in
2828 whole or in part contains or is derived from the Program or any
2829 part thereof, to be licensed as a whole at no charge to all third
2830 parties under the terms of this License.
2831
2832 @item
2833 If the modified program normally reads commands interactively
2834 when run, you must cause it, when started running for such
2835 interactive use in the most ordinary way, to print or display an
2836 announcement including an appropriate copyright notice and a
2837 notice that there is no warranty (or else, saying that you provide
2838 a warranty) and that users may redistribute the program under
2839 these conditions, and telling the user how to view a copy of this
2840 License.  (Exception: if the Program itself is interactive but
2841 does not normally print such an announcement, your work based on
2842 the Program is not required to print an announcement.)
2843 @end enumerate
2844
2845 These requirements apply to the modified work as a whole.  If
2846 identifiable sections of that work are not derived from the Program,
2847 and can be reasonably considered independent and separate works in
2848 themselves, then this License, and its terms, do not apply to those
2849 sections when you distribute them as separate works.  But when you
2850 distribute the same sections as part of a whole which is a work based
2851 on the Program, the distribution of the whole must be on the terms of
2852 this License, whose permissions for other licensees extend to the
2853 entire whole, and thus to each and every part regardless of who wrote it.
2854
2855 Thus, it is not the intent of this section to claim rights or contest
2856 your rights to work written entirely by you; rather, the intent is to
2857 exercise the right to control the distribution of derivative or
2858 collective works based on the Program.
2859
2860 In addition, mere aggregation of another work not based on the Program
2861 with the Program (or with a work based on the Program) on a volume of
2862 a storage or distribution medium does not bring the other work under
2863 the scope of this License.
2864
2865 @item
2866 You may copy and distribute the Program (or a work based on it,
2867 under Section 2) in object code or executable form under the terms of
2868 Sections 1 and 2 above provided that you also do one of the following:
2869
2870 @enumerate a
2871 @item
2872 Accompany it with the complete corresponding machine-readable
2873 source code, which must be distributed under the terms of Sections
2874 1 and 2 above on a medium customarily used for software interchange; or,
2875
2876 @item
2877 Accompany it with a written offer, valid for at least three
2878 years, to give any third party, for a charge no more than your
2879 cost of physically performing source distribution, a complete
2880 machine-readable copy of the corresponding source code, to be
2881 distributed under the terms of Sections 1 and 2 above on a medium
2882 customarily used for software interchange; or,
2883
2884 @item
2885 Accompany it with the information you received as to the offer
2886 to distribute corresponding source code.  (This alternative is
2887 allowed only for noncommercial distribution and only if you
2888 received the program in object code or executable form with such
2889 an offer, in accord with Subsection b above.)
2890 @end enumerate
2891
2892 The source code for a work means the preferred form of the work for
2893 making modifications to it.  For an executable work, complete source
2894 code means all the source code for all modules it contains, plus any
2895 associated interface definition files, plus the scripts used to
2896 control compilation and installation of the executable.  However, as a
2897 special exception, the source code distributed need not include
2898 anything that is normally distributed (in either source or binary
2899 form) with the major components (compiler, kernel, and so on) of the
2900 operating system on which the executable runs, unless that component
2901 itself accompanies the executable.
2902
2903 If distribution of executable or object code is made by offering
2904 access to copy from a designated place, then offering equivalent
2905 access to copy the source code from the same place counts as
2906 distribution of the source code, even though third parties are not
2907 compelled to copy the source along with the object code.
2908
2909 @item
2910 You may not copy, modify, sublicense, or distribute the Program
2911 except as expressly provided under this License.  Any attempt
2912 otherwise to copy, modify, sublicense or distribute the Program is
2913 void, and will automatically terminate your rights under this License.
2914 However, parties who have received copies, or rights, from you under
2915 this License will not have their licenses terminated so long as such
2916 parties remain in full compliance.
2917
2918 @item
2919 You are not required to accept this License, since you have not
2920 signed it.  However, nothing else grants you permission to modify or
2921 distribute the Program or its derivative works.  These actions are
2922 prohibited by law if you do not accept this License.  Therefore, by
2923 modifying or distributing the Program (or any work based on the
2924 Program), you indicate your acceptance of this License to do so, and
2925 all its terms and conditions for copying, distributing or modifying
2926 the Program or works based on it.
2927
2928 @item
2929 Each time you redistribute the Program (or any work based on the
2930 Program), the recipient automatically receives a license from the
2931 original licensor to copy, distribute or modify the Program subject to
2932 these terms and conditions.  You may not impose any further
2933 restrictions on the recipients' exercise of the rights granted herein.
2934 You are not responsible for enforcing compliance by third parties to
2935 this License.
2936
2937 @item
2938 If, as a consequence of a court judgment or allegation of patent
2939 infringement or for any other reason (not limited to patent issues),
2940 conditions are imposed on you (whether by court order, agreement or
2941 otherwise) that contradict the conditions of this License, they do not
2942 excuse you from the conditions of this License.  If you cannot
2943 distribute so as to satisfy simultaneously your obligations under this
2944 License and any other pertinent obligations, then as a consequence you
2945 may not distribute the Program at all.  For example, if a patent
2946 license would not permit royalty-free redistribution of the Program by
2947 all those who receive copies directly or indirectly through you, then
2948 the only way you could satisfy both it and this License would be to
2949 refrain entirely from distribution of the Program.
2950
2951 If any portion of this section is held invalid or unenforceable under
2952 any particular circumstance, the balance of the section is intended to
2953 apply and the section as a whole is intended to apply in other
2954 circumstances.
2955
2956 It is not the purpose of this section to induce you to infringe any
2957 patents or other property right claims or to contest validity of any
2958 such claims; this section has the sole purpose of protecting the
2959 integrity of the free software distribution system, which is
2960 implemented by public license practices.  Many people have made
2961 generous contributions to the wide range of software distributed
2962 through that system in reliance on consistent application of that
2963 system; it is up to the author/donor to decide if he or she is willing
2964 to distribute software through any other system and a licensee cannot
2965 impose that choice.
2966
2967 This section is intended to make thoroughly clear what is believed to
2968 be a consequence of the rest of this License.
2969
2970 @item
2971 If the distribution and/or use of the Program is restricted in
2972 certain countries either by patents or by copyrighted interfaces, the
2973 original copyright holder who places the Program under this License
2974 may add an explicit geographical distribution limitation excluding
2975 those countries, so that distribution is permitted only in or among
2976 countries not thus excluded.  In such case, this License incorporates
2977 the limitation as if written in the body of this License.
2978
2979 @item
2980 The Free Software Foundation may publish revised and/or new versions
2981 of the General Public License from time to time.  Such new versions will
2982 be similar in spirit to the present version, but may differ in detail to
2983 address new problems or concerns.
2984
2985 Each version is given a distinguishing version number.  If the Program
2986 specifies a version number of this License which applies to it and ``any
2987 later version'', you have the option of following the terms and conditions
2988 either of that version or of any later version published by the Free
2989 Software Foundation.  If the Program does not specify a version number of
2990 this License, you may choose any version ever published by the Free Software
2991 Foundation.
2992
2993 @item
2994 If you wish to incorporate parts of the Program into other free
2995 programs whose distribution conditions are different, write to the author
2996 to ask for permission.  For software which is copyrighted by the Free
2997 Software Foundation, write to the Free Software Foundation; we sometimes
2998 make exceptions for this.  Our decision will be guided by the two goals
2999 of preserving the free status of all derivatives of our free software and
3000 of promoting the sharing and reuse of software generally.
3001
3002 @iftex
3003 @heading NO WARRANTY
3004 @end iftex
3005 @ifinfo
3006 @center NO WARRANTY
3007 @end ifinfo
3008 @cindex no warranty
3009
3010 @item
3011 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
3012 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
3013 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
3014 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
3015 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
3016 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
3017 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
3018 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
3019 REPAIR OR CORRECTION.
3020
3021 @item
3022 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
3023 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
3024 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
3025 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
3026 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
3027 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
3028 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
3029 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
3030 POSSIBILITY OF SUCH DAMAGES.
3031 @end enumerate
3032
3033 @iftex
3034 @heading END OF TERMS AND CONDITIONS
3035 @end iftex
3036 @ifinfo
3037 @center END OF TERMS AND CONDITIONS
3038 @end ifinfo
3039
3040 @page
3041 @unnumberedsec How to Apply These Terms to Your New Programs
3042
3043   If you develop a new program, and you want it to be of the greatest
3044 possible use to the public, the best way to achieve this is to make it
3045 free software which everyone can redistribute and change under these terms.
3046
3047   To do so, attach the following notices to the program.  It is safest
3048 to attach them to the start of each source file to most effectively
3049 convey the exclusion of warranty; and each file should have at least
3050 the ``copyright'' line and a pointer to where the full notice is found.
3051
3052 @smallexample
3053 @var{one line to give the program's name and an idea of what it does.}
3054 Copyright (C) 19@var{yy}  @var{name of author}
3055
3056 This program is free software; you can redistribute it and/or
3057 modify it under the terms of the GNU General Public License
3058 as published by the Free Software Foundation; either version 2
3059 of the License, or (at your option) any later version.
3060
3061 This program is distributed in the hope that it will be useful,
3062 but WITHOUT ANY WARRANTY; without even the implied warranty of
3063 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3064 GNU General Public License for more details.
3065
3066 You should have received a copy of the GNU General Public License
3067 along with this program; if not, write to the Free Software
3068 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3069 @end smallexample
3070
3071 Also add information on how to contact you by electronic and paper mail.
3072
3073 If the program is interactive, make it output a short notice like this
3074 when it starts in an interactive mode:
3075
3076 @smallexample
3077 Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
3078 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
3079 type `show w'.  This is free software, and you are welcome
3080 to redistribute it under certain conditions; type `show c' 
3081 for details.
3082 @end smallexample
3083
3084 The hypothetical commands @samp{show w} and @samp{show c} should show
3085 the appropriate parts of the General Public License.  Of course, the
3086 commands you use may be called something other than @samp{show w} and
3087 @samp{show c}; they could even be mouse-clicks or menu items---whatever
3088 suits your program.
3089
3090 You should also get your employer (if you work as a programmer) or your
3091 school, if any, to sign a ``copyright disclaimer'' for the program, if
3092 necessary.  Here is a sample; alter the names:
3093
3094 @smallexample
3095 @group
3096 Yoyodyne, Inc., hereby disclaims all copyright
3097 interest in the program `Gnomovision'
3098 (which makes passes at compilers) written 
3099 by James Hacker.
3100
3101 @var{signature of Ty Coon}, 1 April 1989
3102 Ty Coon, President of Vice
3103 @end group
3104 @end smallexample
3105
3106 This General Public License does not permit incorporating your program into
3107 proprietary programs.  If your program is a subroutine library, you may
3108 consider it more useful to permit linking proprietary applications with the
3109 library.  If this is what you want to do, use the GNU Library General
3110 Public License instead of this License.
3111
3112 @node Concept Index,  , Copying, Top
3113 @unnumbered Concept Index
3114 @printindex cp
3115
3116 @contents
3117
3118 @bye