| 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 | /* ###################################################################### |
| 5 | |
| 6 | HTTP Acquire Method - This is the HTTP aquire method for APT. |
| 7 | |
| 8 | ##################################################################### */ |
| 9 | /*}}}*/ |
| 10 | |
| 11 | #ifndef APT_HTTP_H |
| 12 | #define APT_HTTP_H |
| 13 | |
| 14 | #define MAXLEN 360 |
| 15 | |
| 16 | #include <iostream> |
| 17 | #include <curl/curl.h> |
| 18 | |
| 19 | using std::cout; |
| 20 | using std::endl; |
| 21 | |
| 22 | class HttpsMethod; |
| 23 | |
| 24 | |
| 25 | class HttpsMethod : public pkgAcqMethod |
| 26 | { |
| 27 | // minimum speed in bytes/se that triggers download timeout handling |
| 28 | static const int DL_MIN_SPEED = 10; |
| 29 | |
| 30 | virtual bool Fetch(FetchItem *); |
| 31 | static size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp); |
| 32 | static int progress_callback(void *clientp, double dltotal, double dlnow, |
| 33 | double ultotal, double ulnow); |
| 34 | void SetupProxy(); |
| 35 | CURL *curl; |
| 36 | FetchResult Res; |
| 37 | |
| 38 | public: |
| 39 | FileFd *File; |
| 40 | |
| 41 | HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig) |
| 42 | { |
| 43 | File = 0; |
| 44 | curl = curl_easy_init(); |
| 45 | }; |
| 46 | }; |
| 47 | |
| 48 | URI Proxy; |
| 49 | |
| 50 | #endif |