* ftp.c (ftp_loop_internal): Fix computation of total_downloaded_bytes

When continuing a FTP download, or not starting one because the file is
already fully retrieved, don't include the size of the file in the
total_downloaded_bytes. Only the actual amount of data retrieved over
the network should be considered there.

Fixes: #61277
Reported-By: Michal Ruprich <formaiko>
This commit is contained in:
Darshit Shah
2021-10-08 20:34:46 +02:00
parent 3ea9658c07
commit aecf5fbf1b

View File

@ -2083,7 +2083,7 @@ ftp_loop_internal (struct url *u, struct url *original_url, struct fileinfo *f,
/* --dont-remove-listing was specified, so do count this towards the
number of bytes and files downloaded. */
{
total_downloaded_bytes += qtyread;
total_downloaded_bytes += (qtyread - restval);
numurls++;
}
@ -2098,7 +2098,7 @@ ftp_loop_internal (struct url *u, struct url *original_url, struct fileinfo *f,
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. */
total_downloaded_bytes += qtyread;
total_downloaded_bytes += (qtyread - restval);
numurls++;
if (opt.delete_after && !input_file_url (opt.input_filename))