CurlClient.h 841 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "../common/config.h"
  3. #ifdef HTTPS_BACKEND_CURL
  4. #include <curl/curl.h>
  5. #include "../common/HTTPSClient.h"
  6. #include "../common/LibraryLoader.h"
  7. class CurlClient : public HTTPSClient
  8. {
  9. public:
  10. virtual bool valid() const override;
  11. virtual HTTPSClient::Reply request(const HTTPSClient::Request &req) override;
  12. private:
  13. static struct Curl
  14. {
  15. Curl();
  16. ~Curl();
  17. LibraryLoader::handle *handle;
  18. bool loaded;
  19. decltype(&curl_global_cleanup) global_cleanup;
  20. decltype(&curl_easy_init) easy_init;
  21. decltype(&curl_easy_cleanup) easy_cleanup;
  22. decltype(&curl_easy_setopt) easy_setopt;
  23. decltype(&curl_easy_perform) easy_perform;
  24. decltype(&curl_easy_getinfo) easy_getinfo;
  25. decltype(&curl_slist_append) slist_append;
  26. decltype(&curl_slist_free_all) slist_free_all;
  27. } curl;
  28. };
  29. #endif // HTTPS_BACKEND_CURL