/* This opens a data connection, sends REST and RETR and then
transfers the file over. */
bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
- Hashes &Hash,bool &Missing)
+ Hashes &Hash,bool &Missing, unsigned long long ExpectedSize)
{
Missing = false;
if (CreateDataFd() == false)
{
Close();
return false;
- }
+ }
+
+ if (ExpectedSize > 0 && To.Tell() > ExpectedSize)
+ return _error->Error("Writing more data than expected (%llu > %llu)",
+ To.Tell(), ExpectedSize);
}
// All done
FailFd = Fd.Fd();
bool Missing;
- if (Server->Get(File,Fd,Res.ResumePoint,Hash,Missing) == false)
+ if (Server->Get(File,Fd,Res.ResumePoint,Hash,Missing,Itm->ExpectedSize) == false)
{
Fd.Close();
bool Size(const char *Path,unsigned long long &Size);
bool ModTime(const char *Path, time_t &Time);
bool Get(const char *Path,FileFd &To,unsigned long long Resume,
- Hashes &MD5,bool &Missing);
+ Hashes &MD5,bool &Missing, unsigned long long ExpectedSize);
FTPConn(URI Srv);
~FTPConn();