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

[svn] Applied contributed patches (see ChangeLog for details.)

This commit is contained in:
hniksic 2000-03-02 06:45:37 -08:00
parent 1dc66a6cf6
commit 5d8cfbd904
6 changed files with 50 additions and 15 deletions

View File

@ -1,3 +1,7 @@
1999-08-25 Heiko Herold <Heiko.Herold@previnet.it>
* ftp.c: Respect new option waitretry.
2000-01-30 Damir Dzeko <ddzeko@zesoi.fer.hr> 2000-01-30 Damir Dzeko <ddzeko@zesoi.fer.hr>
* http.c (gethttp): Send custom Referer, if required. * http.c (gethttp): Send custom Referer, if required.

View File

@ -852,8 +852,15 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
/* Increment the pass counter. */ /* Increment the pass counter. */
++count; ++count;
/* Wait before the retrieval (unless this is the very first /* Wait before the retrieval (unless this is the very first
retrieval). */ retrieval).
if (!first_retrieval && opt.wait) Check if we are retrying or not, wait accordingly - HEH */
if (!first_retrieval && (opt.wait || (count && opt.waitretry)))
if (count)
if (count<opt.waitretry)
sleep(count);
else
sleep(opt.waitretry);
else
sleep (opt.wait); sleep (opt.wait);
if (first_retrieval) if (first_retrieval)
first_retrieval = 0; first_retrieval = 0;

View File

@ -488,7 +488,8 @@ User-Agent: %s\r\n\
Host: %s%s\r\n\ Host: %s%s\r\n\
Accept: %s\r\n\ Accept: %s\r\n\
%s%s%s%s%s%s\r\n", %s%s%s%s%s%s\r\n",
command, path, qstring, useragent, remhost, host_port ? host_port : "", command, path, qstring ? qstring : "", useragent, remhost,
host_port ? host_port : "",
HTTP_ACCEPT, referer ? referer : "", HTTP_ACCEPT, referer ? referer : "",
wwwauth ? wwwauth : "", wwwauth ? wwwauth : "",
proxyauth ? proxyauth : "", proxyauth ? proxyauth : "",
@ -957,8 +958,15 @@ File `%s' already there, will not retrieve.\n"), u->local);
/* Increment the pass counter. */ /* Increment the pass counter. */
++count; ++count;
/* Wait before the retrieval (unless this is the very first /* Wait before the retrieval (unless this is the very first
retrieval). */ retrieval).
if (!first_retrieval && opt.wait) Check if we are retrying or not, wait accordingly - HEH */
if (!first_retrieval && (opt.wait || (count && opt.waitretry)))
if (count)
if (count<opt.waitretry)
sleep(count);
else
sleep(opt.waitretry);
else
sleep (opt.wait); sleep (opt.wait);
if (first_retrieval) if (first_retrieval)
first_retrieval = 0; first_retrieval = 0;

View File

@ -151,7 +151,8 @@ static struct {
{ "useproxy", &opt.use_proxy, cmd_boolean }, { "useproxy", &opt.use_proxy, cmd_boolean },
{ "useragent", NULL, cmd_spec_useragent }, { "useragent", NULL, cmd_spec_useragent },
{ "verbose", &opt.verbose, cmd_boolean }, { "verbose", &opt.verbose, cmd_boolean },
{ "wait", &opt.wait, cmd_time } { "wait", &opt.wait, cmd_time },
{ "waitretry", &opt.waitretry, cmd_time }
}; };
/* Return index of COM if it is a valid command, or -1 otherwise. COM /* Return index of COM if it is a valid command, or -1 otherwise. COM

View File

@ -142,6 +142,7 @@ Download:\n\
--spider don\'t download anything.\n\ --spider don\'t download anything.\n\
-T, --timeout=SECONDS set the read timeout to SECONDS.\n\ -T, --timeout=SECONDS set the read timeout to SECONDS.\n\
-w, --wait=SECONDS wait SECONDS between retrievals.\n\ -w, --wait=SECONDS wait SECONDS between retrievals.\n\
--waitretry=SECONDS wait 0..max SECONDS between retries of a retrieval.\n\
-Y, --proxy=on/off turn proxy on or off.\n\ -Y, --proxy=on/off turn proxy on or off.\n\
-Q, --quota=NUMBER set retrieval quota to NUMBER.\n\ -Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
\n"), _("\ \n"), _("\
@ -197,6 +198,7 @@ main (int argc, char *const *argv)
{ {
char **url, **t; char **url, **t;
int i, c, nurl, status, append_to_log; int i, c, nurl, status, append_to_log;
int wr;
static struct option long_options[] = static struct option long_options[] =
{ {
@ -268,6 +270,7 @@ main (int argc, char *const *argv)
{ "referer", required_argument, NULL, 129 }, { "referer", required_argument, NULL, 129 },
{ "use-proxy", required_argument, NULL, 'Y' }, { "use-proxy", required_argument, NULL, 'Y' },
{ "wait", required_argument, NULL, 'w' }, { "wait", required_argument, NULL, 'w' },
{ "waitretry", required_argument, NULL, 24 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -556,6 +559,10 @@ GNU General Public License for more details.\n"));
case 'w': case 'w':
setval ("wait", optarg); setval ("wait", optarg);
break; break;
case 24:
setval ("waitretry", optarg);
wr = 1;
break;
case 'X': case 'X':
setval ("excludedirectories", optarg); setval ("excludedirectories", optarg);
break; break;
@ -574,6 +581,13 @@ GNU General Public License for more details.\n"));
if (opt.verbose == -1) if (opt.verbose == -1)
opt.verbose = !opt.quiet; opt.verbose = !opt.quiet;
/* Retain compatibility with previous scripts.
if wait has been set, but waitretry has not, give it the wait value.
A simple check on the values is not enough, I could have set
wait to n>0 and waitretry to 0 - HEH */
if (opt.wait && !wr)
setval ("waitretry", opt.wait);
/* Sanity checks. */ /* Sanity checks. */
if (opt.verbose && opt.quiet) if (opt.verbose && opt.quiet)
{ {

View File

@ -95,7 +95,8 @@ struct options
long timeout; /* The value of read timeout in long timeout; /* The value of read timeout in
seconds. */ seconds. */
#endif #endif
long wait; /* The wait period between retries. */ long wait; /* The wait period between retrievals. */
long waitretry; /* The wait period between retries. - HEH */
int use_robots; /* Do we heed robots.txt? */ int use_robots; /* Do we heed robots.txt? */
long quota; /* Maximum number of bytes to long quota; /* Maximum number of bytes to