]>
git.saurik.com Git - apt.git/blob - methods/https.h
0147f96a0bb90e9c9ea1efaeb775de9de0e2a741
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>
31 class HttpsServerState
: public ServerState
36 virtual bool ReadHeaderLines(std::string
&/*Data*/) APT_OVERRIDE
{ return false; }
37 virtual bool LoadNextResponse(bool const /*ToFile*/, FileFd
* const /*File*/) APT_OVERRIDE
{ return false; }
40 virtual bool WriteResponse(std::string
const &/*Data*/) APT_OVERRIDE
{ return false; }
42 /** \brief Transfer the data from the socket */
43 virtual bool RunData(FileFd
* const /*File*/) APT_OVERRIDE
{ return false; }
45 virtual bool Open() APT_OVERRIDE
{ return false; }
46 virtual bool IsOpen() APT_OVERRIDE
{ return false; }
47 virtual bool Close() APT_OVERRIDE
{ return false; }
48 virtual bool InitHashes(HashStringList
const &ExpectedHashes
) APT_OVERRIDE
;
49 virtual Hashes
* GetHashes() APT_OVERRIDE
;
50 virtual bool Die(FileFd
&/*File*/) APT_OVERRIDE
{ return false; }
51 virtual bool Flush(FileFd
* const /*File*/) APT_OVERRIDE
{ return false; }
52 virtual bool Go(bool /*ToFile*/, FileFd
* const /*File*/) APT_OVERRIDE
{ return false; }
54 HttpsServerState(URI Srv
, HttpsMethod
*Owner
);
55 virtual ~HttpsServerState() {Close();};
58 class HttpsMethod
: public ServerMethod
60 // minimum speed in bytes/se that triggers download timeout handling
61 static const int DL_MIN_SPEED
= 10;
63 virtual bool Fetch(FetchItem
*) APT_OVERRIDE
;
65 static size_t parse_header(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
66 static size_t write_data(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
67 static int progress_callback(void *clientp
, double dltotal
, double dlnow
,
68 double ultotal
, double ulnow
);
71 std::unique_ptr
<ServerState
> Server
;
73 // Used by ServerMethods unused by https
74 virtual void SendReq(FetchItem
*) APT_OVERRIDE
{ exit(42); }
75 virtual void RotateDNS() APT_OVERRIDE
{ exit(42); }
80 virtual bool Configuration(std::string Message
) APT_OVERRIDE
;
81 virtual std::unique_ptr
<ServerState
> CreateServerState(URI
const &uri
) APT_OVERRIDE
;
82 using pkgAcqMethod::FetchResult
;
83 using pkgAcqMethod::FetchItem
;
85 HttpsMethod() : ServerMethod("https","1.2",Pipeline
| SendConfig
), File(NULL
)
87 curl
= curl_easy_init();
92 curl_easy_cleanup(curl
);
96 #include <apt-pkg/strutl.h>