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