X-Git-Url: https://git.hcoop.net/ntk/apt.git/blobdiff_plain/7330f4df8b31e66f6557bf49c9c90ad9a73ff459..9622b2111095c3fc705ec0615d27fe403e18c3b8:/methods/server.h diff --git a/methods/server.h b/methods/server.h index 2d43b332..f5e68d90 100644 --- a/methods/server.h +++ b/methods/server.h @@ -12,7 +12,10 @@ #define APT_SERVER_H #include +#include +#include +#include #include using std::cout; @@ -32,7 +35,7 @@ struct ServerState // These are some statistics from the last parsed header lines unsigned long long Size; - signed long long StartPos; + unsigned long long StartPos; time_t Date; bool HaveContent; enum {Chunked,Stream,Closes} Encoding; @@ -49,11 +52,12 @@ struct ServerState protected: ServerMethod *Owner; - bool HeaderLine(std::string Line); virtual bool ReadHeaderLines(std::string &Data) = 0; virtual bool LoadNextResponse(bool const ToFile, FileFd * const File) = 0; public: + bool HeaderLine(std::string Line); + /** \brief Result of the header acquire */ enum RunHeadersResult { /** \brief Header ok */ @@ -61,10 +65,10 @@ struct ServerState /** \brief IO error while retrieving */ RUN_HEADERS_IO_ERROR, /** \brief Parse error after retrieving */ - RUN_HEADERS_PARSE_ERROR, + RUN_HEADERS_PARSE_ERROR }; /** \brief Get the headers before the data */ - RunHeadersResult RunHeaders(FileFd * const File); + RunHeadersResult RunHeaders(FileFd * const File, const std::string &Uri); 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; @@ -125,7 +129,7 @@ class ServerMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); virtual bool Configuration(std::string Message); virtual bool Flush() { return Server->Flush(File); }; @@ -134,8 +138,9 @@ class ServerMethod : public pkgAcqMethod virtual void SendReq(FetchItem *Itm) = 0; virtual ServerState * CreateServerState(URI uri) = 0; + virtual void RotateDNS() = 0; - ServerMethod(const char *Ver,unsigned long Flags = 0) : pkgAcqMethod(Ver, Flags), PipelineDepth(0), AllowRedirect(false), Debug(false) {}; + ServerMethod(const char *Ver,unsigned long Flags = 0) : pkgAcqMethod(Ver, Flags), Server(NULL), File(NULL), PipelineDepth(0), AllowRedirect(false), Debug(false) {}; virtual ~ServerMethod() {}; };