https.h 1.2 KB

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