+1999-08-25 Heiko Herold <Heiko.Herold@previnet.it>
+
+ * ftp.c: Respect new option waitretry.
+
2000-01-30 Damir Dzeko <ddzeko@zesoi.fer.hr>
* http.c (gethttp): Send custom Referer, if required.
/* Increment the pass counter. */
++count;
/* Wait before the retrieval (unless this is the very first
- retrieval). */
- if (!first_retrieval && opt.wait)
- sleep (opt.wait);
+ retrieval).
+ 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);
if (first_retrieval)
first_retrieval = 0;
if (con->st & ON_YOUR_OWN)
Host: %s%s\r\n\
Accept: %s\r\n\
%s%s%s%s%s%s\r\n",
- command, path, qstring, useragent, remhost, host_port ? host_port : "",
- HTTP_ACCEPT, referer ? referer : "",
- wwwauth ? wwwauth : "",
- proxyauth ? proxyauth : "",
- range ? range : "",
- pragma_h,
- opt.user_header ? opt.user_header : "");
+ command, path, qstring ? qstring : "", useragent, remhost,
+ host_port ? host_port : "",
+ HTTP_ACCEPT, referer ? referer : "",
+ wwwauth ? wwwauth : "",
+ proxyauth ? proxyauth : "",
+ range ? range : "",
+ pragma_h,
+ opt.user_header ? opt.user_header : "");
DEBUGP (("---request begin---\n%s---request end---\n", request));
/* Free the temporary memory. */
FREE_MAYBE (wwwauth);
/* Increment the pass counter. */
++count;
/* Wait before the retrieval (unless this is the very first
- retrieval). */
- if (!first_retrieval && opt.wait)
- sleep (opt.wait);
+ retrieval).
+ 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);
if (first_retrieval)
first_retrieval = 0;
/* Get the current time string. */
{ "useproxy", &opt.use_proxy, cmd_boolean },
{ "useragent", NULL, cmd_spec_useragent },
{ "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
--spider don\'t download anything.\n\
-T, --timeout=SECONDS set the read timeout to SECONDS.\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\
-Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
\n"), _("\
{
char **url, **t;
int i, c, nurl, status, append_to_log;
+ int wr;
static struct option long_options[] =
{
{ "referer", required_argument, NULL, 129 },
{ "use-proxy", required_argument, NULL, 'Y' },
{ "wait", required_argument, NULL, 'w' },
+ { "waitretry", required_argument, NULL, 24 },
{ 0, 0, 0, 0 }
};
case 'w':
setval ("wait", optarg);
break;
+ case 24:
+ setval ("waitretry", optarg);
+ wr = 1;
+ break;
case 'X':
setval ("excludedirectories", optarg);
break;
if (opt.verbose == -1)
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. */
if (opt.verbose && opt.quiet)
{
long timeout; /* The value of read timeout in
seconds. */
#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? */
long quota; /* Maximum number of bytes to