expected_bytes = ftp_expected_bytes (ftp_last_respline);
} /* cmd & DO_LIST */
+ /* Some FTP servers return the total length of file after REST
+ command, others just return the remaining size. */
+ if (*len && restval && expected_bytes
+ && (expected_bytes == *len - restval))
+ {
+ DEBUGP (("Lying FTP server found, adjusting.\n"));
+ expected_bytes = *len;
+ }
+
/* If no transmission was required, then everything is OK. */
if (!(cmd & (DO_LIST | DO_RETR)))
return RETRFINISHED;
}
}
else
- fp = opt.dfp;
-
- /* Some FTP servers return the total length of file after REST command,
- others just return the remaining size. */
- if (*len && restval && expected_bytes
- && (expected_bytes == *len - restval))
- {
- DEBUGP (("Lying FTP server found, adjusting.\n"));
- expected_bytes = *len;
- }
+ {
+ fp = opt.dfp;
+ if (!restval)
+ {
+ /* This will silently fail for streams that don't correspond
+ to regular files, but that's OK. */
+ rewind (fp);
+ clearerr (fp);
+ }
+ }
if (*len)
{
/* --dont-remove-listing was specified, so do count this towards the
number of bytes and files downloaded. */
{
- opt.downloaded += len;
+ downloaded_increase (len);
opt.numurls++;
}
downloaded if they're going to be deleted. People seeding proxies,
for instance, may want to know how many bytes and files they've
downloaded through it. */
- opt.downloaded += len;
+ downloaded_increase (len);
opt.numurls++;
if (opt.delete_after)
while (f)
{
- if (opt.quota && opt.downloaded > opt.quota)
+ if (downloaded_exceeds_quota ())
{
--depth;
return QUOTEXC;
{
int len;
- if (opt.quota && opt.downloaded > opt.quota)
+ if (downloaded_exceeds_quota ())
break;
if (f->type != FT_DIRECTORY)
continue;
}
}
freefileinfo (start);
- if (opt.quota && opt.downloaded > opt.quota)
+ if (downloaded_exceeds_quota ())
return QUOTEXC;
else
/* #### Should we return `res' here? */