summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/CMakeLists.txt6
-rw-r--r--methods/basehttp.cc (renamed from methods/server.cc)36
-rw-r--r--methods/basehttp.h (renamed from methods/server.h)16
-rw-r--r--methods/http.cc8
-rw-r--r--methods/http.h4
-rw-r--r--methods/https.cc14
-rw-r--r--methods/https.h6
7 files changed, 45 insertions, 45 deletions
diff --git a/methods/CMakeLists.txt b/methods/CMakeLists.txt
index 82ae70e7d..a74c2ce07 100644
--- a/methods/CMakeLists.txt
+++ b/methods/CMakeLists.txt
@@ -4,9 +4,9 @@ add_executable(copy copy.cc)
add_executable(store store.cc)
add_executable(gpgv gpgv.cc)
add_executable(cdrom cdrom.cc)
-add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc server.cc)
-add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc server.cc)
-add_executable(https https.cc server.cc)
+add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc basehttp.cc)
+add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc basehttp.cc)
+add_executable(https https.cc basehttp.cc)
add_executable(ftp ftp.cc rfc2553emu.cc connect.cc)
add_executable(rred rred.cc)
add_executable(rsh rsh.cc)
diff --git a/methods/server.cc b/methods/basehttp.cc
index 29419e5cf..74d641ef2 100644
--- a/methods/server.cc
+++ b/methods/basehttp.cc
@@ -29,15 +29,15 @@
#include <string>
#include <vector>
-#include "server.h"
+#include "basehttp.h"
#include <apti18n.h>
/*}}}*/
using namespace std;
-string ServerMethod::FailFile;
-int ServerMethod::FailFd = -1;
-time_t ServerMethod::FailTime = 0;
+string BaseHttpMethod::FailFile;
+int BaseHttpMethod::FailFd = -1;
+time_t BaseHttpMethod::FailTime = 0;
// ServerState::RunHeaders - Get the headers before the data /*{{{*/
// ---------------------------------------------------------------------
@@ -243,7 +243,7 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
}
/*}}}*/
// ServerState::ServerState - Constructor /*{{{*/
-ServerState::ServerState(URI Srv, ServerMethod *Owner) :
+ServerState::ServerState(URI Srv, BaseHttpMethod *Owner) :
ServerName(Srv), TimeOut(120), Owner(Owner)
{
Reset();
@@ -264,13 +264,13 @@ void ServerState::Reset() /*{{{*/
}
/*}}}*/
-// ServerMethod::DealWithHeaders - Handle the retrieved header data /*{{{*/
+// BaseHttpMethod::DealWithHeaders - Handle the retrieved header data /*{{{*/
// ---------------------------------------------------------------------
/* We look at the header data we got back from the server and decide what
to do. Returns DealWithHeadersResult (see http.h for details).
*/
-ServerMethod::DealWithHeadersResult
-ServerMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
+BaseHttpMethod::DealWithHeadersResult
+BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
{
// Not Modified
if (Req.Result == 304)
@@ -440,11 +440,11 @@ ServerMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
return FILE_IS_OPEN;
}
/*}}}*/
-// ServerMethod::SigTerm - Handle a fatal signal /*{{{*/
+// BaseHttpMethod::SigTerm - Handle a fatal signal /*{{{*/
// ---------------------------------------------------------------------
/* This closes and timestamps the open file. This is necessary to get
resume behavoir on user abort */
-void ServerMethod::SigTerm(int)
+void BaseHttpMethod::SigTerm(int)
{
if (FailFd == -1)
_exit(100);
@@ -459,11 +459,11 @@ void ServerMethod::SigTerm(int)
_exit(100);
}
/*}}}*/
-// ServerMethod::Fetch - Fetch an item /*{{{*/
+// BaseHttpMethod::Fetch - Fetch an item /*{{{*/
// ---------------------------------------------------------------------
/* This adds an item to the pipeline. We keep the pipeline at a fixed
depth. */
-bool ServerMethod::Fetch(FetchItem *)
+bool BaseHttpMethod::Fetch(FetchItem *)
{
if (Server == nullptr || QueueBack == nullptr)
return true;
@@ -530,8 +530,8 @@ bool ServerMethod::Fetch(FetchItem *)
return true;
}
/*}}}*/
-// ServerMethod::Loop - Main loop /*{{{*/
-int ServerMethod::Loop()
+// BaseHttpMethod::Loop - Main loop /*{{{*/
+int BaseHttpMethod::Loop()
{
signal(SIGTERM,SigTerm);
signal(SIGINT,SigTerm);
@@ -783,7 +783,7 @@ int ServerMethod::Loop()
return 0;
}
/*}}}*/
-unsigned long long ServerMethod::FindMaximumObjectSizeInQueue() const /*{{{*/
+unsigned long long BaseHttpMethod::FindMaximumObjectSizeInQueue() const /*{{{*/
{
unsigned long long MaxSizeInQueue = 0;
for (FetchItem *I = Queue; I != 0 && I != QueueBack; I = I->Next)
@@ -791,13 +791,13 @@ unsigned long long ServerMethod::FindMaximumObjectSizeInQueue() const /*{{{*/
return MaxSizeInQueue;
}
/*}}}*/
-ServerMethod::ServerMethod(std::string &&Binary, char const * const Ver,unsigned long const Flags) :/*{{{*/
+BaseHttpMethod::BaseHttpMethod(std::string &&Binary, char const * const Ver,unsigned long const Flags) :/*{{{*/
aptMethod(std::move(Binary), Ver, Flags), Server(nullptr), PipelineDepth(10),
AllowRedirect(false), Debug(false)
{
}
/*}}}*/
-bool ServerMethod::Configuration(std::string Message) /*{{{*/
+bool BaseHttpMethod::Configuration(std::string Message) /*{{{*/
{
if (aptMethod::Configuration(Message) == false)
return false;
@@ -807,7 +807,7 @@ bool ServerMethod::Configuration(std::string Message) /*{{{*/
return true;
}
/*}}}*/
-bool ServerMethod::AddProxyAuth(URI &Proxy, URI const &Server) const /*{{{*/
+bool BaseHttpMethod::AddProxyAuth(URI &Proxy, URI const &Server) const /*{{{*/
{
if (std::find(methodNames.begin(), methodNames.end(), "tor") != methodNames.end() &&
Proxy.User == "apt-transport-tor" && Proxy.Password.empty())
diff --git a/methods/server.h b/methods/basehttp.h
index 6b12c7c7a..41a9a4306 100644
--- a/methods/server.h
+++ b/methods/basehttp.h
@@ -24,7 +24,7 @@ using std::cout;
using std::endl;
class Hashes;
-class ServerMethod;
+class BaseHttpMethod;
struct ServerState;
struct RequestState
@@ -53,13 +53,13 @@ struct RequestState
FileFd File;
- ServerMethod * const Owner;
+ BaseHttpMethod * const Owner;
ServerState * const Server;
bool HeaderLine(std::string const &Line);
bool AddPartialFileToHashes(FileFd &File);
- RequestState(ServerMethod * const Owner, ServerState * const Server) :
+ RequestState(BaseHttpMethod * const Owner, ServerState * const Server) :
Owner(Owner), Server(Server) { time(&Date); }
};
@@ -75,7 +75,7 @@ struct ServerState
unsigned long TimeOut;
protected:
- ServerMethod *Owner;
+ BaseHttpMethod *Owner;
virtual bool ReadHeaderLines(std::string &Data) = 0;
virtual bool LoadNextResponse(bool const ToFile, RequestState &Req) = 0;
@@ -111,11 +111,11 @@ struct ServerState
virtual bool Go(bool ToFile, RequestState &Req) = 0;
virtual Hashes * GetHashes() = 0;
- ServerState(URI Srv, ServerMethod *Owner);
+ ServerState(URI Srv, BaseHttpMethod *Owner);
virtual ~ServerState() {};
};
-class ServerMethod : public aptMethod
+class BaseHttpMethod : public aptMethod
{
protected:
virtual bool Fetch(FetchItem *) APT_OVERRIDE;
@@ -166,8 +166,8 @@ class ServerMethod : public aptMethod
bool AddProxyAuth(URI &Proxy, URI const &Server) const;
- ServerMethod(std::string &&Binary, char const * const Ver,unsigned long const Flags);
- virtual ~ServerMethod() {};
+ BaseHttpMethod(std::string &&Binary, char const * const Ver,unsigned long const Flags);
+ virtual ~BaseHttpMethod() {};
};
#endif
diff --git a/methods/http.cc b/methods/http.cc
index b460644dd..9f5959548 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -977,10 +977,10 @@ void HttpMethod::RotateDNS() /*{{{*/
::RotateDNS();
}
/*}}}*/
-ServerMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)/*{{{*/
+BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)/*{{{*/
{
- auto ret = ServerMethod::DealWithHeaders(Res, Req);
- if (ret != ServerMethod::FILE_IS_OPEN)
+ auto ret = BaseHttpMethod::DealWithHeaders(Res, Req);
+ if (ret != BaseHttpMethod::FILE_IS_OPEN)
return ret;
if (Req.File.Open(Queue->DestFile, FileFd::WriteAny) == false)
return ERROR_NOT_FROM_SERVER;
@@ -1002,7 +1002,7 @@ ServerMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res
return FILE_IS_OPEN;
}
/*}}}*/
-HttpMethod::HttpMethod(std::string &&pProg) : ServerMethod(pProg.c_str(), "1.2", Pipeline | SendConfig)/*{{{*/
+HttpMethod::HttpMethod(std::string &&pProg) : BaseHttpMethod(pProg.c_str(), "1.2", Pipeline | SendConfig)/*{{{*/
{
auto addName = std::inserter(methodNames, methodNames.begin());
if (Binary != "http")
diff --git a/methods/http.h b/methods/http.h
index 4b0e77524..c79a6454e 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -17,7 +17,7 @@
#include <sys/time.h>
#include <iostream>
-#include "server.h"
+#include "basehttp.h"
using std::cout;
using std::endl;
@@ -121,7 +121,7 @@ struct HttpServerState: public ServerState
virtual ~HttpServerState() {Close();};
};
-class HttpMethod : public ServerMethod
+class HttpMethod : public BaseHttpMethod
{
public:
virtual void SendReq(FetchItem *Itm) APT_OVERRIDE;
diff --git a/methods/https.cc b/methods/https.cc
index c473e474d..d60bc6fbc 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -458,22 +458,22 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
switch (DealWithHeaders(Res, Req))
{
- case ServerMethod::IMS_HIT:
+ case BaseHttpMethod::IMS_HIT:
URIDone(Res);
break;
- case ServerMethod::ERROR_WITH_CONTENT_PAGE:
+ case BaseHttpMethod::ERROR_WITH_CONTENT_PAGE:
// unlink, no need keep 401/404 page content in partial/
RemoveFile(Binary.c_str(), Req.File.Name());
- case ServerMethod::ERROR_UNRECOVERABLE:
- case ServerMethod::ERROR_NOT_FROM_SERVER:
+ case BaseHttpMethod::ERROR_UNRECOVERABLE:
+ case BaseHttpMethod::ERROR_NOT_FROM_SERVER:
return false;
- case ServerMethod::TRY_AGAIN_OR_REDIRECT:
+ case BaseHttpMethod::TRY_AGAIN_OR_REDIRECT:
Redirect(NextURI);
break;
- case ServerMethod::FILE_IS_OPEN:
+ case BaseHttpMethod::FILE_IS_OPEN:
struct stat resultStat;
if (unlikely(stat(Req.File.Name().c_str(), &resultStat) != 0))
{
@@ -510,7 +510,7 @@ std::unique_ptr<ServerState> HttpsMethod::CreateServerState(URI const &uri)/*{{{
return std::unique_ptr<ServerState>(new HttpsServerState(uri, this));
}
/*}}}*/
-HttpsMethod::HttpsMethod(std::string &&pProg) : ServerMethod(std::move(pProg),"1.2",Pipeline | SendConfig)/*{{{*/
+HttpsMethod::HttpsMethod(std::string &&pProg) : BaseHttpMethod(std::move(pProg),"1.2",Pipeline | SendConfig)/*{{{*/
{
auto addName = std::inserter(methodNames, methodNames.begin());
addName = "http";
diff --git a/methods/https.h b/methods/https.h
index 3b99b3abe..fbbf34501 100644
--- a/methods/https.h
+++ b/methods/https.h
@@ -17,7 +17,7 @@
#include <string>
#include <memory>
-#include "server.h"
+#include "basehttp.h"
using std::cout;
using std::endl;
@@ -54,7 +54,7 @@ class HttpsServerState : public ServerState
virtual ~HttpsServerState() {Close();};
};
-class HttpsMethod : public ServerMethod
+class HttpsMethod : public BaseHttpMethod
{
// minimum speed in bytes/se that triggers download timeout handling
static const int DL_MIN_SPEED = 10;
@@ -68,7 +68,7 @@ class HttpsMethod : public ServerMethod
bool SetupProxy();
CURL *curl;
- // Used by ServerMethods unused by https
+ // Used by BaseHttpMethods unused by https
virtual void SendReq(FetchItem *) APT_OVERRIDE { exit(42); }
virtual void RotateDNS() APT_OVERRIDE { exit(42); }