summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-10-07 17:47:30 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-10-07 17:47:30 +0200
commitc48eea97b93920062ea26001081d4fdf7eb967e3 (patch)
tree84e5609e0f35579a8ccca029794555fd6c0bbc80 /methods
parentc86bc8515a3a195aa244a1743476b102d72c9a2a (diff)
make expected-size a maximum-size check as this is what we want at this point
Diffstat (limited to 'methods')
-rw-r--r--methods/ftp.cc8
-rw-r--r--methods/ftp.h2
-rw-r--r--methods/http.cc4
-rw-r--r--methods/https.cc4
-rw-r--r--methods/server.cc4
-rw-r--r--methods/server.h4
6 files changed, 13 insertions, 13 deletions
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 75ace1c5a..bc84dda7d 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -849,7 +849,7 @@ bool FTPConn::Finalize()
/* 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, unsigned long long ExpectedSize)
+ Hashes &Hash,bool &Missing, unsigned long long MaximumSize)
{
Missing = false;
if (CreateDataFd() == false)
@@ -924,9 +924,9 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
return false;
}
- if (ExpectedSize > 0 && To.Tell() > ExpectedSize)
+ if (MaximumSize > 0 && To.Tell() > MaximumSize)
return _error->Error("Writing more data than expected (%llu > %llu)",
- To.Tell(), ExpectedSize);
+ To.Tell(), MaximumSize);
}
// All done
@@ -1067,7 +1067,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
FailFd = Fd.Fd();
bool Missing;
- if (Server->Get(File,Fd,Res.ResumePoint,Hash,Missing,Itm->ExpectedSize) == false)
+ if (Server->Get(File,Fd,Res.ResumePoint,Hash,Missing,Itm->MaximumSize) == false)
{
Fd.Close();
diff --git a/methods/ftp.h b/methods/ftp.h
index 416a91980..a31ebc999 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -62,7 +62,7 @@ class FTPConn
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, unsigned long long ExpectedSize);
+ Hashes &MD5,bool &Missing, unsigned long long MaximumSize);
FTPConn(URI Srv);
~FTPConn();
diff --git a/methods/http.cc b/methods/http.cc
index b076e59cc..f8faa0cf8 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -655,10 +655,10 @@ bool HttpServerState::Go(bool ToFile, FileFd * const File)
return _error->Errno("write",_("Error writing to output file"));
}
- if (ExpectedSize > 0 && File && File->Tell() > ExpectedSize)
+ if (MaximumSize > 0 && File && File->Tell() > MaximumSize)
{
return _error->Error("Writing more data than expected (%llu > %llu)",
- File->Tell(), ExpectedSize);
+ File->Tell(), MaximumSize);
}
// Handle commands from APT
diff --git a/methods/https.cc b/methods/https.cc
index a4794e705..787e4a507 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -82,9 +82,9 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp)
if(me->File->Write(buffer, size*nmemb) != true)
return false;
- if(me->Queue->ExpectedSize > 0 && me->File->Tell() > me->Queue->ExpectedSize)
+ if(me->Queue->MaximumSize > 0 && me->File->Tell() > me->Queue->MaximumSize)
return _error->Error("Writing more data than expected (%llu > %llu)",
- me->TotalWritten, me->Queue->ExpectedSize);
+ me->TotalWritten, me->Queue->MaximumSize);
return size*nmemb;
}
diff --git a/methods/server.cc b/methods/server.cc
index 223737901..82f9b4750 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -534,8 +534,8 @@ int ServerMethod::Loop()
bool Result = true;
// ensure we don't fetch too much
- if (Queue->ExpectedSize > 0)
- Server->ExpectedSize = Queue->ExpectedSize;
+ if (Queue->MaximumSize > 0)
+ Server->MaximumSize = Queue->MaximumSize;
if (Server->HaveContent)
Result = Server->RunData(File);
diff --git a/methods/server.h b/methods/server.h
index 0134a9538..3093e00c9 100644
--- a/methods/server.h
+++ b/methods/server.h
@@ -49,7 +49,7 @@ struct ServerState
URI Proxy;
unsigned long TimeOut;
- unsigned long long ExpectedSize;
+ unsigned long long MaximumSize;
protected:
ServerMethod *Owner;
@@ -75,7 +75,7 @@ struct ServerState
bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
virtual void Reset() {Major = 0; Minor = 0; Result = 0; Code[0] = '\0'; Size = 0;
StartPos = 0; Encoding = Closes; time(&Date); HaveContent = false;
- State = Header; Persistent = false; Pipeline = true; ExpectedSize = 0;};
+ State = Header; Persistent = false; Pipeline = true; MaximumSize = 0;};
virtual bool WriteResponse(std::string const &Data) = 0;
/** \brief Transfer the data from the socket */