summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
commit71ecaad29d8066a494f516efc5efd80860653fe2 (patch)
treeb0769df88e2b6496f23e3d899aeb1c240a3488d9 /methods
parenta865ed25fa54514224cf4d6f83dd9cf48b7ed02b (diff)
parent37adedc9d0b66eeae7efb88aebd08dfbc6e06f77 (diff)
merged from http://bzr.debian.org/bzr/apt/apt/debian-experimental2
Diffstat (limited to 'methods')
-rw-r--r--methods/bzip2.cc9
-rw-r--r--methods/cdrom.cc6
-rw-r--r--methods/connect.cc20
-rw-r--r--methods/connect.h5
-rw-r--r--methods/copy.cc5
-rw-r--r--methods/file.cc9
-rw-r--r--methods/ftp.cc22
-rw-r--r--methods/ftp.h18
-rw-r--r--methods/gpgv.cc16
-rw-r--r--methods/gzip.cc6
-rw-r--r--methods/http.cc50
-rw-r--r--methods/http.h65
-rw-r--r--methods/http_main.cc2
-rw-r--r--methods/https.cc8
-rw-r--r--methods/https.h3
-rw-r--r--methods/mirror.cc13
-rw-r--r--methods/mirror.h25
-rw-r--r--methods/rfc2553emu.cc4
-rw-r--r--methods/rred.cc16
-rw-r--r--methods/rsh.cc42
-rw-r--r--methods/rsh.h26
21 files changed, 220 insertions, 150 deletions
diff --git a/methods/bzip2.cc b/methods/bzip2.cc
index 42932dded..8e7e46557 100644
--- a/methods/bzip2.cc
+++ b/methods/bzip2.cc
@@ -13,11 +13,14 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -45,9 +48,9 @@ class Bzip2Method : public pkgAcqMethod
bool Bzip2Method::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
- string GzPathOption = "Dir::bin::"+string(Prog);
+ std::string GzPathOption = "Dir::bin::" + std::string(Prog);
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -76,7 +79,7 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
SetCloseExec(STDOUT_FILENO,false);
const char *Args[3];
- string Tmp = _config->Find(GzPathOption,Prog);
+ std::string Tmp = _config->Find(GzPathOption,Prog);
Args[0] = Tmp.c_str();
Args[1] = "-d";
Args[2] = 0;
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index b25fdf5a8..e7114b168 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -8,12 +8,15 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/cdrom.h>
#include <apt-pkg/cdromutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
#include <sys/stat.h>
@@ -54,7 +57,8 @@ class CDROMMethod : public pkgAcqMethod
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
SendConfig | NeedsCleanup |
Removable),
- DatabaseLoaded(false),
+ DatabaseLoaded(false),
+ Debug(false),
MountedByApt(false)
{
UdevCdroms.Dlopen();
diff --git a/methods/connect.cc b/methods/connect.cc
index a5af1f1a6..9a092a43c 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -11,9 +11,12 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include "connect.h"
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/acquire-method.h>
#include <stdio.h>
#include <errno.h>
@@ -29,17 +32,18 @@
#include <arpa/inet.h>
#include <netdb.h>
+#include "connect.h"
#include "rfc2553emu.h"
#include <apti18n.h>
/*}}}*/
-static string LastHost;
+static std::string LastHost;
static int LastPort = 0;
static struct addrinfo *LastHostAddr = 0;
static struct addrinfo *LastUsed = 0;
// Set of IP/hostnames that we timed out before or couldn't resolve
-static std::set<string> bad_addr;
+static std::set<std::string> bad_addr;
// RotateDNS - Select a new server from a DNS rotation /*{{{*/
// ---------------------------------------------------------------------
@@ -56,7 +60,7 @@ void RotateDNS()
// DoConnect - Attempt a connect operation /*{{{*/
// ---------------------------------------------------------------------
/* This helper function attempts a connection to a single address. */
-static bool DoConnect(struct addrinfo *Addr,string Host,
+static bool DoConnect(struct addrinfo *Addr,std::string Host,
unsigned long TimeOut,int &Fd,pkgAcqMethod *Owner)
{
// Show a status indicator
@@ -71,7 +75,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
Owner->Status(_("Connecting to %s (%s)"),Host.c_str(),Name);
// if that addr did timeout before, we do not try it again
- if(bad_addr.find(string(Name)) != bad_addr.end())
+ if(bad_addr.find(std::string(Name)) != bad_addr.end())
return false;
/* If this is an IP rotation store the IP we are using.. If something goes
@@ -98,7 +102,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
/* This implements a timeout for connect by opening the connection
nonblocking */
if (WaitFd(Fd,true,TimeOut) == false) {
- bad_addr.insert(bad_addr.begin(), string(Name));
+ bad_addr.insert(bad_addr.begin(), std::string(Name));
Owner->SetFailReason("Timeout");
return _error->Error(_("Could not connect to %s:%s (%s), "
"connection timed out"),Host.c_str(),Service,Name);
@@ -117,7 +121,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
Owner->SetFailReason("ConnectionRefused");
else if (errno == ETIMEDOUT)
Owner->SetFailReason("ConnectionTimedOut");
- bad_addr.insert(bad_addr.begin(), string(Name));
+ bad_addr.insert(bad_addr.begin(), std::string(Name));
return _error->Errno("connect",_("Could not connect to %s:%s (%s)."),Host.c_str(),
Service,Name);
}
@@ -128,7 +132,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
// Connect - Connect to a server /*{{{*/
// ---------------------------------------------------------------------
/* Performs a connection to the server */
-bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd,
+bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
unsigned long TimeOut,pkgAcqMethod *Owner)
{
if (_error->PendingError() == true)
diff --git a/methods/connect.h b/methods/connect.h
index 6f208e31d..bbe1bb35d 100644
--- a/methods/connect.h
+++ b/methods/connect.h
@@ -11,9 +11,10 @@
#define CONNECT_H
#include <string>
-#include <apt-pkg/acquire-method.h>
-bool Connect(string To,int Port,const char *Service,int DefPort,
+class pkgAcqMethod;
+
+bool Connect(std::string To,int Port,const char *Service,int DefPort,
int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner);
void RotateDNS();
diff --git a/methods/copy.cc b/methods/copy.cc
index a6bb372a3..f8d58e479 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -9,7 +9,10 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
@@ -35,7 +38,7 @@ class CopyMethod : public pkgAcqMethod
bool CopyMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string File = Get.Path;
+ std::string File = Get.Path;
// Stat the file and send a start message
struct stat Buf;
diff --git a/methods/file.cc b/methods/file.cc
index 9cdd5bc2d..5025c996d 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -13,10 +13,13 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -38,7 +41,7 @@ class FileMethod : public pkgAcqMethod
bool FileMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string File = Get.Path;
+ std::string File = Get.Path;
FetchResult Res;
if (Get.Host.empty() == false)
return _error->Error(_("Invalid URI, local URIS must not start with //"));
@@ -56,10 +59,10 @@ bool FileMethod::Fetch(FetchItem *Itm)
}
// See if we can compute a file without a .gz exentsion
- string::size_type Pos = File.rfind(".gz");
+ std::string::size_type Pos = File.rfind(".gz");
if (Pos + 3 == File.length())
{
- File = string(File,0,Pos);
+ File = std::string(File,0,Pos);
if (stat(File.c_str(),&Buf) == 0)
{
FetchResult AltRes;
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 97248f900..2ca0ac6f7 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -15,11 +15,14 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -30,7 +33,6 @@
#include <errno.h>
#include <stdarg.h>
#include <iostream>
-#include <apti18n.h>
// Internet stuff
#include <netinet/in.h>
@@ -41,6 +43,7 @@
#include "rfc2553emu.h"
#include "connect.h"
#include "ftp.h"
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -69,7 +72,8 @@ time_t FtpMethod::FailTime = 0;
// ---------------------------------------------------------------------
/* */
FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1),
- DataListenFd(-1), ServerName(Srv)
+ DataListenFd(-1), ServerName(Srv),
+ ForceExtended(false), TryPassive(true)
{
Debug = _config->FindB("Debug::Acquire::Ftp",false);
PasvAddr = 0;
@@ -559,7 +563,7 @@ bool FTPConn::ExtGoPasv()
string::const_iterator List[4];
unsigned Count = 0;
Pos++;
- for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++)
+ for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I)
{
if (*I != Msg[Pos])
continue;
@@ -627,7 +631,7 @@ bool FTPConn::ExtGoPasv()
// FTPConn::Size - Return the size of a file /*{{{*/
// ---------------------------------------------------------------------
/* Grab the file size from the server, 0 means no size or empty file */
-bool FTPConn::Size(const char *Path,unsigned long &Size)
+bool FTPConn::Size(const char *Path,unsigned long long &Size)
{
// Query the size
unsigned int Tag;
@@ -637,7 +641,7 @@ bool FTPConn::Size(const char *Path,unsigned long &Size)
return false;
char *End;
- Size = strtol(Msg.c_str(),&End,10);
+ Size = strtoull(Msg.c_str(),&End,10);
if (Tag >= 400 || End == Msg.c_str())
Size = 0;
return true;
@@ -839,7 +843,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 Resume,
+bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
Hashes &Hash,bool &Missing)
{
Missing = false;
@@ -1002,7 +1006,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
// Get the files information
Status(_("Query"));
- unsigned long Size;
+ unsigned long long Size;
if (Server->Size(File,Size) == false ||
Server->ModTime(File,FailTime) == false)
{
@@ -1024,7 +1028,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
struct stat Buf;
if (stat(Itm->DestFile.c_str(),&Buf) == 0)
{
- if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime)
+ if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime)
{
Res.Size = Buf.st_size;
Res.LastModified = Buf.st_mtime;
@@ -1034,7 +1038,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
}
// Resume?
- if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+ if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
Res.ResumePoint = Buf.st_size;
}
diff --git a/methods/ftp.h b/methods/ftp.h
index d7f1f7fbe..2634f0732 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -10,6 +10,10 @@
#ifndef APT_FTP_H
#define APT_FTP_H
+#include <apt-pkg/strutl.h>
+
+#include <string>
+
class FTPConn
{
char Buffer[1024*10];
@@ -33,7 +37,7 @@ class FTPConn
socklen_t ServerAddrLen;
// Private helper functions
- bool ReadLine(string &Text);
+ bool ReadLine(std::string &Text);
bool Login();
bool CreateDataFd();
bool Finalize();
@@ -43,8 +47,8 @@ class FTPConn
bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port && Other.User == ServerName.User && Other.Password == ServerName.Password; };
// Raw connection IO
- bool ReadResp(unsigned int &Ret,string &Text);
- bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...);
+ bool ReadResp(unsigned int &Ret,std::string &Text);
+ bool WriteMsg(unsigned int &Ret,std::string &Text,const char *Fmt,...);
// Connection control
bool Open(pkgAcqMethod *Owner);
@@ -53,9 +57,9 @@ class FTPConn
bool ExtGoPasv();
// Query
- bool Size(const char *Path,unsigned long &Size);
+ 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 Resume,
+ bool Get(const char *Path,FileFd &To,unsigned long long Resume,
Hashes &MD5,bool &Missing);
FTPConn(URI Srv);
@@ -65,11 +69,11 @@ class FTPConn
class FtpMethod : public pkgAcqMethod
{
virtual bool Fetch(FetchItem *Itm);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
FTPConn *Server;
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 960c06180..2b2aba017 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -1,9 +1,11 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexcopy.h>
-#include <apti18n.h>
+#include <apt-pkg/configuration.h>
#include <utime.h>
#include <stdio.h>
@@ -12,9 +14,13 @@
#include <sys/wait.h>
#include <iostream>
#include <sstream>
-
#include <vector>
+#include <apti18n.h>
+
+using std::string;
+using std::vector;
+
#define GNUPGPREFIX "[GNUPG:]"
#define GNUPGBADSIG "[GNUPG:] BADSIG"
#define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
@@ -213,21 +219,21 @@ bool GPGVMethod::Fetch(FetchItem *Itm)
{
errmsg += _("The following signatures were invalid:\n");
for (vector<string>::iterator I = BadSigners.begin();
- I != BadSigners.end(); I++)
+ I != BadSigners.end(); ++I)
errmsg += (*I + "\n");
}
if (!WorthlessSigners.empty())
{
errmsg += _("The following signatures were invalid:\n");
for (vector<string>::iterator I = WorthlessSigners.begin();
- I != WorthlessSigners.end(); I++)
+ I != WorthlessSigners.end(); ++I)
errmsg += (*I + "\n");
}
if (!NoPubKeySigners.empty())
{
errmsg += _("The following signatures couldn't be verified because the public key is not available:\n");
for (vector<string>::iterator I = NoPubKeySigners.begin();
- I != NoPubKeySigners.end(); I++)
+ I != NoPubKeySigners.end(); ++I)
errmsg += (*I + "\n");
}
}
diff --git a/methods/gzip.cc b/methods/gzip.cc
index fc4e1ecfd..a51497948 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -9,6 +9,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
@@ -39,7 +41,7 @@ class GzipMethod : public pkgAcqMethod
bool GzipMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -62,7 +64,7 @@ bool GzipMethod::Fetch(FetchItem *Itm)
while (1)
{
unsigned char Buffer[4*1024];
- unsigned long Count;
+ unsigned long long Count = 0;
if (!From.Read(Buffer,sizeof(Buffer),&Count))
{
diff --git a/methods/http.cc b/methods/http.cc
index 13f9cbe06..0d81c73ed 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -25,8 +25,11 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/netrc.h>
@@ -41,8 +44,6 @@
#include <string.h>
#include <iostream>
#include <map>
-#include <apti18n.h>
-
// Internet stuff
#include <netdb.h>
@@ -51,6 +52,8 @@
#include "connect.h"
#include "rfc2553emu.h"
#include "http.h"
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -63,15 +66,15 @@ bool AllowRedirect = false;
bool Debug = false;
URI Proxy;
-unsigned long CircleBuf::BwReadLimit=0;
-unsigned long CircleBuf::BwTickReadData=0;
+unsigned long long CircleBuf::BwReadLimit=0;
+unsigned long long CircleBuf::BwTickReadData=0;
struct timeval CircleBuf::BwReadTick={0,0};
const unsigned int CircleBuf::BW_HZ=10;
// CircleBuf::CircleBuf - Circular input buffer /*{{{*/
// ---------------------------------------------------------------------
/* */
-CircleBuf::CircleBuf(unsigned long Size) : Size(Size), Hash(0)
+CircleBuf::CircleBuf(unsigned long long Size) : Size(Size), Hash(0)
{
Buf = new unsigned char[Size];
Reset();
@@ -87,7 +90,7 @@ void CircleBuf::Reset()
InP = 0;
OutP = 0;
StrPos = 0;
- MaxGet = (unsigned int)-1;
+ MaxGet = (unsigned long long)-1;
OutQueue = string();
if (Hash != 0)
{
@@ -102,7 +105,7 @@ void CircleBuf::Reset()
is non-blocking.. */
bool CircleBuf::Read(int Fd)
{
- unsigned long BwReadMax;
+ unsigned long long BwReadMax;
while (1)
{
@@ -117,7 +120,7 @@ bool CircleBuf::Read(int Fd)
struct timeval now;
gettimeofday(&now,0);
- unsigned long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
+ unsigned long long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
now.tv_usec-CircleBuf::BwReadTick.tv_usec;
if(d > 1000000/BW_HZ) {
CircleBuf::BwReadTick = now;
@@ -131,7 +134,7 @@ bool CircleBuf::Read(int Fd)
}
// Write the buffer segment
- int Res;
+ ssize_t Res;
if(CircleBuf::BwReadLimit) {
Res = read(Fd,Buf + (InP%Size),
BwReadMax > LeftRead() ? LeftRead() : BwReadMax);
@@ -180,7 +183,7 @@ void CircleBuf::FillOut()
return;
// Write the buffer segment
- unsigned long Sz = LeftRead();
+ unsigned long long Sz = LeftRead();
if (OutQueue.length() - StrPos < Sz)
Sz = OutQueue.length() - StrPos;
memcpy(Buf + (InP%Size),OutQueue.c_str() + StrPos,Sz);
@@ -214,7 +217,7 @@ bool CircleBuf::Write(int Fd)
return true;
// Write the buffer segment
- int Res;
+ ssize_t Res;
Res = write(Fd,Buf + (OutP%Size),LeftWrite());
if (Res == 0)
@@ -240,7 +243,7 @@ bool CircleBuf::Write(int Fd)
bool CircleBuf::WriteTillEl(string &Data,bool Single)
{
// We cheat and assume it is unneeded to have more than one buffer load
- for (unsigned long I = OutP; I < InP; I++)
+ for (unsigned long long I = OutP; I < InP; I++)
{
if (Buf[I%Size] != '\n')
continue;
@@ -258,7 +261,7 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
Data = "";
while (OutP < I)
{
- unsigned long Sz = LeftWrite();
+ unsigned long long Sz = LeftWrite();
if (Sz == 0)
return false;
if (I - OutP < Sz)
@@ -286,6 +289,11 @@ void CircleBuf::Stats()
clog << "Got " << InP << " in " << Diff << " at " << InP/Diff << endl;*/
}
/*}}}*/
+CircleBuf::~CircleBuf()
+{
+ delete [] Buf;
+ delete Hash;
+}
// ServerState::ServerState - Constructor /*{{{*/
// ---------------------------------------------------------------------
@@ -402,10 +410,10 @@ ServerState::RunHeadersResult ServerState::RunHeaders()
if (Debug == true)
clog << Data;
- for (string::const_iterator I = Data.begin(); I < Data.end(); I++)
+ for (string::const_iterator I = Data.begin(); I < Data.end(); ++I)
{
string::const_iterator J = I;
- for (; J != Data.end() && *J != '\n' && *J != '\r';J++);
+ for (; J != Data.end() && *J != '\n' && *J != '\r'; ++J);
if (HeaderLine(string(I,J)) == false)
return RUN_HEADERS_PARSE_ERROR;
I = J;
@@ -453,7 +461,7 @@ bool ServerState::RunData()
return false;
// See if we are done
- unsigned long Len = strtol(Data.c_str(),0,16);
+ unsigned long long Len = strtoull(Data.c_str(),0,16);
if (Len == 0)
{
In.Limit(-1);
@@ -596,7 +604,7 @@ bool ServerState::HeaderLine(string Line)
if (StartPos != 0)
return true;
- if (sscanf(Val.c_str(),"%lu",&Size) != 1)
+ if (sscanf(Val.c_str(),"%llu",&Size) != 1)
return _error->Error(_("The HTTP server sent an invalid Content-Length header"));
return true;
}
@@ -611,9 +619,9 @@ bool ServerState::HeaderLine(string Line)
{
HaveContent = true;
- if (sscanf(Val.c_str(),"bytes %lu-%*u/%lu",&StartPos,&Size) != 2)
+ if (sscanf(Val.c_str(),"bytes %llu-%*u/%llu",&StartPos,&Size) != 2)
return _error->Error(_("The HTTP server sent an invalid Content-Range header"));
- if ((unsigned)StartPos > Size)
+ if ((unsigned long long)StartPos > Size)
return _error->Error(_("This HTTP server has broken range support"));
return true;
}
@@ -716,7 +724,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
{
// In this case we send an if-range query with a range header
- sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",(long)SBuf.st_size - 1,
+ sprintf(Buf,"Range: bytes=%lli-\r\nIf-Range: %s\r\n",(long long)SBuf.st_size - 1,
TimeRFC1123(SBuf.st_mtime).c_str());
Req += Buf;
}
@@ -1325,7 +1333,7 @@ int HttpMethod::Loop()
StopRedirects = true;
else
{
- for (StringVectorIterator I = R.begin(); I != R.end(); I++)
+ for (StringVectorIterator I = R.begin(); I != R.end(); ++I)
if (Queue->Uri == *I)
{
R[0] = "STOP";
diff --git a/methods/http.h b/methods/http.h
index aa96c6810..c73d4df5c 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -13,39 +13,42 @@
#define MAXLEN 360
-#include <apt-pkg/hashes.h>
+#include <apt-pkg/strutl.h>
+
+#include <string>
using std::cout;
using std::endl;
class HttpMethod;
+class Hashes;
class CircleBuf
{
unsigned char *Buf;
- unsigned long Size;
- unsigned long InP;
- unsigned long OutP;
- string OutQueue;
- unsigned long StrPos;
- unsigned long MaxGet;
+ unsigned long long Size;
+ unsigned long long InP;
+ unsigned long long OutP;
+ std::string OutQueue;
+ unsigned long long StrPos;
+ unsigned long long MaxGet;
struct timeval Start;
- static unsigned long BwReadLimit;
- static unsigned long BwTickReadData;
+ static unsigned long long BwReadLimit;
+ static unsigned long long BwTickReadData;
static struct timeval BwReadTick;
static const unsigned int BW_HZ;
- unsigned long LeftRead()
+ unsigned long long LeftRead() const
{
- unsigned long Sz = Size - (InP - OutP);
+ unsigned long long Sz = Size - (InP - OutP);
if (Sz > Size - (InP%Size))
Sz = Size - (InP%Size);
return Sz;
}
- unsigned long LeftWrite()
+ unsigned long long LeftWrite() const
{
- unsigned long Sz = InP - OutP;
+ unsigned long long Sz = InP - OutP;
if (InP > MaxGet)
Sz = MaxGet - OutP;
if (Sz > Size - (OutP%Size))
@@ -60,27 +63,27 @@ class CircleBuf
// Read data in
bool Read(int Fd);
- bool Read(string Data);
+ bool Read(std::string Data);
// Write data out
bool Write(int Fd);
- bool WriteTillEl(string &Data,bool Single = false);
+ bool WriteTillEl(std::string &Data,bool Single = false);
// Control the write limit
- void Limit(long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}
- bool IsLimit() {return MaxGet == OutP;};
- void Print() {cout << MaxGet << ',' << OutP << endl;};
+ void Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}
+ bool IsLimit() const {return MaxGet == OutP;};
+ void Print() const {cout << MaxGet << ',' << OutP << endl;};
// Test for free space in the buffer
- bool ReadSpace() {return Size - (InP - OutP) > 0;};
- bool WriteSpace() {return InP - OutP > 0;};
+ bool ReadSpace() const {return Size - (InP - OutP) > 0;};
+ bool WriteSpace() const {return InP - OutP > 0;};
// Dump everything
void Reset();
void Stats();
- CircleBuf(unsigned long Size);
- ~CircleBuf() {delete [] Buf; delete Hash;};
+ CircleBuf(unsigned long long Size);
+ ~CircleBuf();
};
struct ServerState
@@ -92,14 +95,14 @@ struct ServerState
char Code[MAXLEN];
// These are some statistics from the last parsed header lines
- unsigned long Size;
- signed long StartPos;
+ unsigned long long Size;
+ signed long long StartPos;
time_t Date;
bool HaveContent;
enum {Chunked,Stream,Closes} Encoding;
enum {Header, Data} State;
bool Persistent;
- string Location;
+ std::string Location;
// This is a Persistent attribute of the server itself.
bool Pipeline;
@@ -112,8 +115,8 @@ struct ServerState
int ServerFd;
URI ServerName;
- bool HeaderLine(string Line);
- bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+ bool HeaderLine(std::string Line);
+ bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0;
Encoding = Closes; time(&Date); ServerFd = -1;
Pipeline = true;};
@@ -167,10 +170,10 @@ class HttpMethod : public pkgAcqMethod
/** \brief Try to AutoDetect the proxy */
bool AutoDetectProxy();
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
// In the event of a fatal signal this file will be closed and timestamped.
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);
@@ -178,8 +181,8 @@ class HttpMethod : public pkgAcqMethod
protected:
virtual bool Fetch(FetchItem *);
- string NextURI;
- string AutoDetectProxyCmd;
+ std::string NextURI;
+ std::string AutoDetectProxyCmd;
public:
friend struct ServerState;
diff --git a/methods/http_main.cc b/methods/http_main.cc
index 7815c2fc1..2ca91bfc9 100644
--- a/methods/http_main.cc
+++ b/methods/http_main.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <signal.h>
diff --git a/methods/https.cc b/methods/https.cc
index 668a329e6..335699907 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -10,11 +10,14 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -25,12 +28,11 @@
#include <errno.h>
#include <string.h>
#include <iostream>
-#include <apti18n.h>
#include <sstream>
#include "config.h"
#include "https.h"
-
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -51,7 +53,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow,
{
HttpsMethod *me = (HttpsMethod *)clientp;
if(dltotal > 0 && me->Res.Size == 0) {
- me->Res.Size = (unsigned long)dltotal;
+ me->Res.Size = (unsigned long long)dltotal;
me->URIStart(me->Res);
}
return 0;
diff --git a/methods/https.h b/methods/https.h
index 3f0c416b6..b7adeb880 100644
--- a/methods/https.h
+++ b/methods/https.h
@@ -20,7 +20,7 @@ using std::cout;
using std::endl;
class HttpsMethod;
-
+class FileFd;
class HttpsMethod : public pkgAcqMethod
{
@@ -45,6 +45,7 @@ class HttpsMethod : public pkgAcqMethod
};
};
+#include <apt-pkg/strutl.h>
URI Proxy;
#endif
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 7f28c04cb..3d5983efa 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -8,6 +8,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
@@ -16,7 +18,8 @@
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/sourcelist.h>
-
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
#include <algorithm>
#include <fstream>
@@ -34,7 +37,7 @@ using namespace std;
#include "mirror.h"
#include "http.h"
-#include "apti18n.h"
+#include <apti18n.h>
/*}}}*/
/* Done:
@@ -55,7 +58,7 @@ using namespace std;
*/
MirrorMethod::MirrorMethod()
- : HttpMethod(), DownloadedMirrorFile(false)
+ : HttpMethod(), DownloadedMirrorFile(false), Debug(false)
{
};
@@ -108,7 +111,7 @@ bool MirrorMethod::Clean(string Dir)
continue;
// see if we have that uri
- for(I=list.begin(); I != list.end(); I++)
+ for(I=list.begin(); I != list.end(); ++I)
{
string uri = (*I)->GetURI();
if(uri.find("mirror://") != 0)
@@ -346,7 +349,7 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str)
vector<metaIndex *>::const_iterator I;
pkgSourceList list;
list.ReadMainList();
- for(I=list.begin(); I != list.end(); I++)
+ for(I=list.begin(); I != list.end(); ++I)
{
string uristr = (*I)->GetURI();
if(Debug)
diff --git a/methods/mirror.h b/methods/mirror.h
index 97d18144a..81e531e21 100644
--- a/methods/mirror.h
+++ b/methods/mirror.h
@@ -11,8 +11,9 @@
#ifndef APT_MIRROR_H
#define APT_MIRROR_H
-
#include <iostream>
+#include <string>
+#include <vector>
using std::cout;
using std::cerr;
@@ -24,29 +25,29 @@ class MirrorMethod : public HttpMethod
{
FetchResult Res;
// we simply transform between BaseUri and Mirror
- string BaseUri; // the original mirror://... url
- string Mirror; // the selected mirror uri (http://...)
- vector<string> AllMirrors; // all available mirrors
- string MirrorFile; // the file that contains the list of mirrors
+ std::string BaseUri; // the original mirror://... url
+ std::string Mirror; // the selected mirror uri (http://...)
+ std::vector<std::string> AllMirrors; // all available mirrors
+ std::string MirrorFile; // the file that contains the list of mirrors
bool DownloadedMirrorFile; // already downloaded this session
- string Dist; // the target distrubtion (e.g. sid, oneiric)
+ std::string Dist; // the target distrubtion (e.g. sid, oneiric)
bool Debug;
protected:
- bool DownloadMirrorFile(string uri);
- bool RandomizeMirrorFile(string file);
- string GetMirrorFileName(string uri);
+ bool DownloadMirrorFile(std::string uri);
+ bool RandomizeMirrorFile(std::string file);
+ std::string GetMirrorFileName(std::string uri);
bool InitMirrors();
bool TryNextMirror();
void CurrentQueueUriToMirror();
- bool Clean(string dir);
+ bool Clean(std::string dir);
// we need to overwrite those to transform the url back
- virtual void Fail(string Why, bool Transient = false);
+ virtual void Fail(std::string Why, bool Transient = false);
virtual void URIStart(FetchResult &Res);
virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
public:
MirrorMethod();
diff --git a/methods/rfc2553emu.cc b/methods/rfc2553emu.cc
index 66bc906e9..f00e85889 100644
--- a/methods/rfc2553emu.cc
+++ b/methods/rfc2553emu.cc
@@ -14,12 +14,14 @@
##################################################################### */
/*}}}*/
-#include "rfc2553emu.h"
+#include <config.h>
+
#include <stdlib.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>
+#include "rfc2553emu.h"
#ifndef HAVE_GETADDRINFO
// getaddrinfo - Resolve a hostname /*{{{*/
diff --git a/methods/rred.cc b/methods/rred.cc
index 849973e1a..ef00fcaa3 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -1,10 +1,13 @@
// Includes /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/mmap.h>
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
#include <sys/stat.h>
#include <sys/uio.h>
@@ -51,7 +54,7 @@ protected:
virtual bool Fetch(FetchItem *Itm);
public:
- RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
+ RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig), Debug(false) {};
};
/*}}}*/
/** \brief applyFile - in reverse order with a tail recursion {{{
@@ -239,7 +242,9 @@ RredMethod::State RredMethod::patchFile(FileFd &Patch, FileFd &From, /*{{{*/
return result;
}
/*}}}*/
-struct EdCommand { /*{{{*/
+/* struct EdCommand {{{*/
+#ifdef _POSIX_MAPPED_FILES
+struct EdCommand {
size_t data_start;
size_t data_end;
size_t data_lines;
@@ -248,13 +253,14 @@ struct EdCommand { /*{{{*/
char type;
};
#define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
+#endif
/*}}}*/
RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/
FileFd &out_file, Hashes *hash) const {
#ifdef _POSIX_MAPPED_FILES
MMap ed_cmds(MMap::ReadOnly);
if (Patch.gzFd() != NULL) {
- unsigned long mapSize = Patch.Size();
+ unsigned long long mapSize = Patch.Size();
DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
if (dyn->validData() == false) {
delete dyn;
@@ -467,7 +473,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
{
Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -520,7 +526,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
and use the access time from the "old" file */
struct stat BufBase, BufPatch;
if (stat(Path.c_str(),&BufBase) != 0 ||
- stat(string(Path+".ed").c_str(),&BufPatch) != 0)
+ stat(std::string(Path+".ed").c_str(),&BufPatch) != 0)
return _error->Errno("stat",_("Failed to stat"));
struct utimbuf TimeBuf;
diff --git a/methods/rsh.cc b/methods/rsh.cc
index 21f0d0a22..da9777fc4 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -11,8 +11,12 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include "rsh.h"
+#include <config.h>
+
#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -22,6 +26,8 @@
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
+#include "rsh.h"
+
#include <apti18n.h>
/*}}}*/
@@ -29,7 +35,7 @@ const char *Prog;
unsigned long TimeOut = 120;
Configuration::Item const *RshOptions = 0;
time_t RSHMethod::FailTime = 0;
-string RSHMethod::FailFile;
+std::string RSHMethod::FailFile;
int RSHMethod::FailFd = -1;
// RSHConn::RSHConn - Constructor /*{{{*/
@@ -82,7 +88,7 @@ bool RSHConn::Open()
// RSHConn::Connect - Fire up rsh and connect /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::Connect(string Host, string User)
+bool RSHConn::Connect(std::string Host, std::string User)
{
// Create the pipes
int Pipes[4] = {-1,-1,-1,-1};
@@ -151,7 +157,7 @@ bool RSHConn::Connect(string Host, string User)
// RSHConn::ReadLine - Very simple buffered read with timeout /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::ReadLine(string &Text)
+bool RSHConn::ReadLine(std::string &Text)
{
if (Process == -1 || ReadFd == -1)
return false;
@@ -171,7 +177,7 @@ bool RSHConn::ReadLine(string &Text)
continue;
I++;
- Text = string(Buffer,I);
+ Text = std::string(Buffer,I);
memmove(Buffer,Buffer+I,Len - I);
Len -= I;
return true;
@@ -202,7 +208,7 @@ bool RSHConn::ReadLine(string &Text)
// ---------------------------------------------------------------------
/* The remote sync flag appends a || echo which will insert blank line
once the command completes. */
-bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
+bool RSHConn::WriteMsg(std::string &Text,bool Sync,const char *Fmt,...)
{
va_list args;
va_start(args,Fmt);
@@ -248,10 +254,10 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
// ---------------------------------------------------------------------
/* Right now for successfull transfer the file size must be known in
advance. */
-bool RSHConn::Size(const char *Path,unsigned long &Size)
+bool RSHConn::Size(const char *Path,unsigned long long &Size)
{
// Query the size
- string Msg;
+ std::string Msg;
Size = 0;
if (WriteMsg(Msg,true,"find %s -follow -printf '%%s\\n'",Path) == false)
@@ -260,7 +266,7 @@ bool RSHConn::Size(const char *Path,unsigned long &Size)
// FIXME: Sense if the bad reply is due to a File Not Found.
char *End;
- Size = strtoul(Msg.c_str(),&End,10);
+ Size = strtoull(Msg.c_str(),&End,10);
if (End == Msg.c_str())
return _error->Error(_("File not found"));
return true;
@@ -273,7 +279,7 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
{
Time = time(&Time);
// Query the mod time
- string Msg;
+ std::string Msg;
if (WriteMsg(Msg,true,"TZ=UTC find %s -follow -printf '%%TY%%Tm%%Td%%TH%%TM%%TS\\n'",Path) == false)
return false;
@@ -285,8 +291,8 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
// RSHConn::Get - Get a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
- Hashes &Hash,bool &Missing, unsigned long Size)
+bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
+ Hashes &Hash,bool &Missing, unsigned long long Size)
{
Missing = false;
@@ -306,12 +312,12 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
}
// FIXME: Detect file-not openable type errors.
- string Jnk;
+ std::string Jnk;
if (WriteMsg(Jnk,false,"dd if=%s bs=2048 skip=%u", Path, Resume / 2048) == false)
return false;
// Copy loop
- unsigned int MyLen = Resume;
+ unsigned long long MyLen = Resume;
unsigned char Buffer[4096];
while (MyLen < Size)
{
@@ -363,7 +369,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
/*}}}*/
// RSHMethod::Configuration - Handle a configuration message /*{{{*/
// ---------------------------------------------------------------------
-bool RSHMethod::Configuration(string Message)
+bool RSHMethod::Configuration(std::string Message)
{
char ProgStr[100];
@@ -425,7 +431,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
Status(_("Connecting to %s"), Get.Host.c_str());
// Get the files information
- unsigned long Size;
+ unsigned long long Size;
if (Server->Size(File,Size) == false ||
Server->ModTime(File,FailTime) == false)
{
@@ -446,7 +452,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
// See if the file exists
struct stat Buf;
if (stat(Itm->DestFile.c_str(),&Buf) == 0) {
- if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime) {
+ if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime) {
Res.Size = Buf.st_size;
Res.LastModified = Buf.st_mtime;
Res.ResumePoint = Buf.st_size;
@@ -455,7 +461,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
}
// Resume?
- if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+ if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
Res.ResumePoint = Buf.st_size;
}
diff --git a/methods/rsh.h b/methods/rsh.h
index b06d5a94e..d7efa3f06 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -12,9 +12,9 @@
#include <string>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/acquire-method.h>
-#include <apt-pkg/fileutl.h>
+
+class Hashes;
+class FileFd;
class RSHConn
{
@@ -25,39 +25,41 @@ class RSHConn
URI ServerName;
// Private helper functions
- bool ReadLine(string &Text);
+ bool ReadLine(std::string &Text);
public:
pid_t Process;
// Raw connection IO
- bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
- bool Connect(string Host, string User);
- bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+ bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
+ bool Connect(std::string Host, std::string User);
+ bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
// Connection control
bool Open();
void Close();
// Query
- bool Size(const char *Path,unsigned long &Size);
+ 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 Resume,
- Hashes &Hash,bool &Missing, unsigned long Size);
+ bool Get(const char *Path,FileFd &To,unsigned long long Resume,
+ Hashes &Hash,bool &Missing, unsigned long long Size);
RSHConn(URI Srv);
~RSHConn();
};
+#include <apt-pkg/acquire-method.h>
+
class RSHMethod : public pkgAcqMethod
{
virtual bool Fetch(FetchItem *Itm);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
RSHConn *Server;
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);