]>
git.saurik.com Git - apt.git/blob - methods/https.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
3 // $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
4 /* ######################################################################
6 HTTP Acquire Method - This is the HTTP acquire method for APT.
8 ##################################################################### */
14 #include <apt-pkg/acquire-method.h>
16 #include <curl/curl.h>
30 class HttpsServerState
: public ServerState
35 virtual bool ReadHeaderLines(std::string
&/*Data*/) { return false; }
36 virtual bool LoadNextResponse(bool const /*ToFile*/, FileFd
* const /*File*/) { return false; }
39 virtual bool WriteResponse(std::string
const &/*Data*/) { return false; }
41 /** \brief Transfer the data from the socket */
42 virtual bool RunData(FileFd
* const /*File*/) { return false; }
44 virtual bool Open() { return false; }
45 virtual bool IsOpen() { return false; }
46 virtual bool Close() { return false; }
47 virtual bool InitHashes(HashStringList
const &ExpectedHashes
);
48 virtual Hashes
* GetHashes();
49 virtual bool Die(FileFd
&/*File*/) { return false; }
50 virtual bool Flush(FileFd
* const /*File*/) { return false; }
51 virtual bool Go(bool /*ToFile*/, FileFd
* const /*File*/) { return false; }
53 HttpsServerState(URI Srv
, HttpsMethod
*Owner
);
54 virtual ~HttpsServerState() {Close();};
57 class HttpsMethod
: public ServerMethod
59 // minimum speed in bytes/se that triggers download timeout handling
60 static const int DL_MIN_SPEED
= 10;
62 virtual bool Fetch(FetchItem
*);
64 static size_t parse_header(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
65 static size_t write_data(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
66 static int progress_callback(void *clientp
, double dltotal
, double dlnow
,
67 double ultotal
, double ulnow
);
72 // Used by ServerMethods unused by https
73 virtual void SendReq(FetchItem
*) { exit(42); }
74 virtual void RotateDNS() { exit(42); }
79 virtual bool Configuration(std::string Message
);
80 virtual ServerState
* CreateServerState(URI uri
);
81 using pkgAcqMethod::FetchResult
;
82 using pkgAcqMethod::FetchItem
;
84 HttpsMethod() : ServerMethod("1.2",Pipeline
| SendConfig
), File(NULL
)
86 curl
= curl_easy_init();
91 curl_easy_cleanup(curl
);
95 #include <apt-pkg/strutl.h>