1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] New option --dns-cache.

This commit is contained in:
hniksic 2003-09-10 12:41:54 -07:00
parent cd8b1259f1
commit 10137bd186
8 changed files with 50 additions and 7 deletions

4
TODO
View File

@ -15,10 +15,6 @@ represent user-visible changes.
mirror remote FTP permissions by default. There should be a new
option add an option that enables this back on.
* Implement a `--disable-dns-cache' option that disables DNS caching.
It is trivial to implement; simply avoid calling cache_host_lookup
at the end of lookup_host.
* Honor `Content-Disposition: XXX; filename="FILE"' when creating the
file name.

View File

@ -1,3 +1,7 @@
2003-09-10 Hrvoje Niksic <hniksic@xemacs.org>
* wget.texi (Download Options): Documented new option --dns-cache.
2002-04-24 Hrvoje Niksic <hniksic@arsdigita.com>
* wget.texi (Robot Exclusion): Explain how to turn off the robot

View File

@ -16,8 +16,8 @@
@c This should really be generated automatically, possibly by including
@c an auto-generated file.
@set VERSION 1.8.1+cvs
@set UPDATED December 2001
@set VERSION 1.9-cvs
@set UPDATED September 2003
@dircategory Net Utilities
@dircategory World Wide Web
@ -777,6 +777,29 @@ Thus you may safely type @samp{wget -Q2m -i sites}---download will be
aborted when the quota is exceeded.
Setting quota to 0 or to @samp{inf} unlimits the download quota.
@cindex DNS cache
@cindex caching of DNS lookups
@itemx --dns-cache=off
Turn off caching of DNS lookups. Normally, Wget remembers the addresses
it looked up from DNS so it doesn't have to repeatedly contact the DNS
server for the same (typically small) set of addresses it retrieves
from. This cache exists in memory only; a new Wget run will contact DNS
again.
However, in some cases it is not desirable to cache host names, even for
the duration of a short-running application like Wget. For example,
some HTTP servers are hosted on machines with dynamically allocated IP
addresses that change from time to time. Their DNS entries are updated
along with each change. When Wget's download from such a host gets
interrupted by IP address change, Wget retries the download, but (due to
DNS caching) it contacts the old address. With the DNS cache turned
off, Wget will repeat the DNS lookup for every connect and will thus get
the correct dynamic address every time---at the cost of additional DNS
lookups where they're probably not needed.
If you don't understand the above description, you probably won't need
this option.
@end table
@node Directory Options, HTTP Options, Download Options, Invoking
@ -2046,6 +2069,10 @@ Top of directory tree---the same as @samp{-P}.
Turning dirstruct on or off---the same as @samp{-x} or @samp{-nd},
respectively.
@item dns_cache = on/off
Turn DNS caching on/off. Since DNS caching is on by default, this
option is normally used to turn it off. Same as @samp{--dns-cache}.
@item domains = @var{string}
Same as @samp{-D} (@pxref{Spanning Hosts}).

View File

@ -1,3 +1,9 @@
2003-09-10 Hrvoje Niksic <hniksic@xemacs.org>
* init.c: New command dns_cache.
* main.c (main): New option --dns-cache[=off].
2003-09-09 Hrvoje Niksic <hniksic@xemacs.org>
* config.h.in: Initialize HAVE_GETADDRINFO and ENABLE_IPV6.

View File

@ -691,6 +691,7 @@ lookup_host (const char *host, int silent)
logprintf (LOG_VERBOSE, _("done.\n"));
/* Cache the lookup information. */
if (opt.dns_cache)
cache_host_lookup (host, al);
return al;

View File

@ -131,6 +131,7 @@ static struct {
{ "deleteafter", &opt.delete_after, cmd_boolean },
{ "dirprefix", &opt.dir_prefix, cmd_directory },
{ "dirstruct", NULL, cmd_spec_dirstruct },
{ "dnscache", &opt.dns_cache, cmd_boolean },
{ "domains", &opt.domains, cmd_vector },
{ "dotbytes", &opt.dot_bytes, cmd_bytes },
{ "dotsinline", &opt.dots_in_line, cmd_number },
@ -278,6 +279,8 @@ defaults (void)
opt.dot_bytes = 1024;
opt.dot_spacing = 10;
opt.dots_in_line = 50;
opt.dns_cache = 1;
}
/* Return the user's home directory (strdup-ed), or NULL if none is

View File

@ -178,6 +178,7 @@ Download:\n\
-Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n\
--limit-rate=RATE limit download rate to RATE.\n\
--dns-cache=off disable caching DNS lookups.\n\
\n"), stdout);
fputs (_("\
Directories:\n\
@ -314,6 +315,7 @@ main (int argc, char *const *argv)
{ "cookies", required_argument, NULL, 160 },
{ "cut-dirs", required_argument, NULL, 145 },
{ "directory-prefix", required_argument, NULL, 'P' },
{ "dns-cache", required_argument, NULL, 175 },
{ "domains", required_argument, NULL, 'D' },
{ "dot-style", required_argument, NULL, 134 },
{ "execute", required_argument, NULL, 'e' },
@ -605,6 +607,9 @@ GNU General Public License for more details.\n"));
case 168:
setval ("postfile", optarg);
break;
case 175:
setval ("dnscache", optarg);
break;
case 'A':
setval ("accept", optarg);
break;

View File

@ -70,6 +70,7 @@ struct options
char **domains; /* See host.c */
char **exclude_domains;
int dns_cache; /* whether we cache DNS lookups. */
char **follow_tags; /* List of HTML tags to recursively follow. */
char **ignore_tags; /* List of HTML tags to ignore if recursing. */