]>
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 aquire method for APT.
8 ##################################################################### */
15 #include <curl/curl.h>
25 class HttpsServerState
: public ServerState
28 virtual bool ReadHeaderLines(std::string
&Data
) { return false; }
29 virtual bool LoadNextResponse(bool const ToFile
, FileFd
* const File
) { return false; }
32 virtual bool WriteResponse(std::string
const &Data
) { return false; }
34 /** \brief Transfer the data from the socket */
35 virtual bool RunData(FileFd
* const File
) { return false; }
37 virtual bool Open() { return false; }
38 virtual bool IsOpen() { return false; }
39 virtual bool Close() { return false; }
40 virtual bool InitHashes(FileFd
&File
) { return false; }
41 virtual Hashes
* GetHashes() { return NULL
; }
42 virtual bool Die(FileFd
&File
) { return false; }
43 virtual bool Flush(FileFd
* const File
) { return false; }
44 virtual bool Go(bool ToFile
, FileFd
* const File
) { return false; }
46 HttpsServerState(URI Srv
, HttpsMethod
*Owner
);
47 virtual ~HttpsServerState() {Close();};
50 class HttpsMethod
: public pkgAcqMethod
52 // minimum speed in bytes/se that triggers download timeout handling
53 static const int DL_MIN_SPEED
= 10;
55 virtual bool Fetch(FetchItem
*);
56 static size_t parse_header(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
57 static size_t write_data(void *buffer
, size_t size
, size_t nmemb
, void *userp
);
58 static int progress_callback(void *clientp
, double dltotal
, double dlnow
,
59 double ultotal
, double ulnow
);
63 HttpsServerState
*Server
;
68 HttpsMethod() : pkgAcqMethod("1.2",Pipeline
| SendConfig
)
71 curl
= curl_easy_init();
76 curl_easy_cleanup(curl
);
80 #include <apt-pkg/strutl.h>