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